hivectl: shell completions verb + ship zsh/bash/fish completions (#1764)
Add a 'hivectl completions <shell>' subcommand (clap_complete) that prints a completion script for bash/zsh/fish/elvish/powershell, generated from hivectl's own clap command tree so it never drifts from the real verbs/flags. The package build installs the bash/zsh/fish scripts via installShellFiles, so an operator gets working completion automatically once hivectl is on their profile with shell completion enabled. Regenerated docs/tools/hivectl-cli.md for the new verb.
This commit is contained in:
parent
f5003fd1bb
commit
c7612dcf2b
6 changed files with 73 additions and 1 deletions
18
flake.nix
18
flake.nix
|
|
@ -163,11 +163,27 @@
|
|||
# to that one check — `nix flake check` still exercises them.
|
||||
default = craneLib.buildPackage {
|
||||
src = cleanSrc;
|
||||
inherit cargoArtifacts nativeBuildInputs;
|
||||
inherit cargoArtifacts;
|
||||
# `installShellFiles` provides `installShellCompletion` for the
|
||||
# postInstall below; appended (not in the shared set) so it's a
|
||||
# build input only of this binary derivation.
|
||||
nativeBuildInputs = nativeBuildInputs ++ [ pkgs.installShellFiles ];
|
||||
pname = "hyperhive-workspace";
|
||||
version = "0.1.0";
|
||||
meta.description = "hyperhive workspace (hive-c0re, hive-ag3nt, hive-root)";
|
||||
doCheck = false;
|
||||
# Ship hivectl shell completions in the package (the binary's own
|
||||
# `completions <shell>` verb is the single source of truth, so they
|
||||
# never drift from the actual verbs). Lands at
|
||||
# `$out/share/{zsh/site-functions,bash-completion,fish}/…`; an
|
||||
# operator gets working completion as soon as hivectl is in their
|
||||
# system/user profile with the shell's completion enabled.
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd hivectl \
|
||||
--bash <("$out/bin/hivectl" completions bash) \
|
||||
--zsh <("$out/bin/hivectl" completions zsh) \
|
||||
--fish <("$out/bin/hivectl" completions fish)
|
||||
'';
|
||||
};
|
||||
# Bundled browser assets — see ./nix/frontend.nix. Output is
|
||||
# $out/{dashboard,agent}/ which the Rust binaries serve via
|
||||
|
|
|
|||
Loading…
Reference in a new issue