docs: commit generated hivectl cli reference + flake freshness check
This commit is contained in:
parent
ad8a3a8cbf
commit
fac5437508
3 changed files with 314 additions and 0 deletions
21
flake.nix
21
flake.nix
|
|
@ -368,6 +368,27 @@
|
|||
# `packages.<system>.docs` derivation so the per-system eval
|
||||
# of `nix/docs/default.nix` happens once.
|
||||
inherit (self.packages.${system}) docs;
|
||||
# `hivectl` CLI reference freshness check. The committed
|
||||
# markdown at `docs/tools/hivectl-cli.md` is the rendered
|
||||
# output of the hidden `hivectl markdown-docs` subcommand
|
||||
# (clap-markdown walks the binary's own command tree). This
|
||||
# check regenerates it from the built binary and fails if the
|
||||
# committed copy drifted — so a verb / flag / help-string edit
|
||||
# that forgets to refresh the doc is caught in CI. Reuses the
|
||||
# already-built `packages.<system>.default` (no extra compile).
|
||||
# Regenerate locally with:
|
||||
# nix build .#default
|
||||
# ./result/bin/hivectl markdown-docs > docs/tools/hivectl-cli.md
|
||||
hivectl-docs = pkgs.runCommand "hivectl-docs-fresh" { nativeBuildInputs = [ pkgs.diffutils ]; } ''
|
||||
${self.packages.${system}.default}/bin/hivectl markdown-docs > generated.md
|
||||
if ! diff -u ${./docs/tools/hivectl-cli.md} generated.md; then
|
||||
echo "" >&2
|
||||
echo "ERROR: docs/tools/hivectl-cli.md is out of date — regenerate it:" >&2
|
||||
echo " nix build .#default && ./result/bin/hivectl markdown-docs > docs/tools/hivectl-cli.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
touch "$out"
|
||||
'';
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue