mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
refactor: don't hardcode nix subcommands in run-help-nix
This commit is contained in:
parent
0f7c7ab97b
commit
68d51ae012
1 changed files with 16 additions and 71 deletions
|
@ -18,80 +18,25 @@ emulate -L zsh
|
||||||
#
|
#
|
||||||
# bindkey '^[h' run-help
|
# bindkey '^[h' run-help
|
||||||
|
|
||||||
if (( $# == 0 )); then
|
|
||||||
man nix
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [[ "$#" != 0 && "$1" == -* ]]; do
|
while [[ "$#" != 0 && "$1" == -* ]]; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
case "$1" in
|
local -a subcommands; subcommands=( nix3 )
|
||||||
flake)
|
|
||||||
case "$2" in
|
local arg
|
||||||
archive|check|clone|info|init|lock|metadata|new|prefetch|show|update)
|
for arg in "$@"; do
|
||||||
man "nix3-$1-$2" ;;
|
if man -w "${(j:-:)subcommands}-$arg" >/dev/null 2>&1; then
|
||||||
*)
|
subcommands+="$arg"
|
||||||
man "nix3-$1" ;;
|
else
|
||||||
esac ;;
|
break
|
||||||
hash)
|
fi
|
||||||
case "$2" in
|
done
|
||||||
file|path|to-base16|to-base32|to-base64|to-sri)
|
|
||||||
man "nix3-$1-$2" ;;
|
if (( $#subcommands > 1 )); then
|
||||||
*)
|
man "${(j:-:)subcommands}"
|
||||||
man "nix3-$1" ;;
|
else
|
||||||
esac ;;
|
man nix
|
||||||
key)
|
fi
|
||||||
case "$2" in
|
|
||||||
convert-secret-to-public|generate-secret)
|
|
||||||
man "nix3-$1-$2" ;;
|
|
||||||
*)
|
|
||||||
man "nix3-$1" ;;
|
|
||||||
esac ;;
|
|
||||||
nar)
|
|
||||||
case "$2" in
|
|
||||||
cat|dump-path|ls)
|
|
||||||
man "nix3-$1-$2" ;;
|
|
||||||
*)
|
|
||||||
man "nix3-$1" ;;
|
|
||||||
esac ;;
|
|
||||||
profile)
|
|
||||||
case "$2" in
|
|
||||||
diff-closures|history|install|list|remove|rollback|upgrade|wipe-history)
|
|
||||||
man "nix3-$1-$2" ;;
|
|
||||||
*)
|
|
||||||
man "nix3-$1" ;;
|
|
||||||
esac ;;
|
|
||||||
realisation)
|
|
||||||
case "$2" in
|
|
||||||
info)
|
|
||||||
man "nix3-$1-$2" ;;
|
|
||||||
*)
|
|
||||||
man "nix3-$1" ;;
|
|
||||||
esac ;;
|
|
||||||
registry)
|
|
||||||
case "$2" in
|
|
||||||
add|list|pin|remove)
|
|
||||||
man "nix3-$1-$2" ;;
|
|
||||||
*)
|
|
||||||
man "nix3-$1" ;;
|
|
||||||
esac ;;
|
|
||||||
store)
|
|
||||||
case "$2" in
|
|
||||||
add-file|add-path|cat|copy-sigs|delete|diff-closures|dump-path|gc|ls)
|
|
||||||
;& # fallthrough
|
|
||||||
make-content-addressed|optimise|ping|prefetch-file|repair|sign|verify)
|
|
||||||
man "nix3-$1-$2" ;;
|
|
||||||
*)
|
|
||||||
man "nix3-$1" ;;
|
|
||||||
esac ;;
|
|
||||||
*)
|
|
||||||
if man -w "nix3-$1" >/dev/null 2>&1; then
|
|
||||||
man "nix3-$1"
|
|
||||||
else
|
|
||||||
man nix
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
|
|
Loading…
Reference in a new issue