1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 16:19:44 +01:00
home-manager/home-manager/completion.zsh
Dusk Banks 63af2d3e4c
home-manager: add home-manager option
This adds functionality much like that provided by `nixos-option`.
2021-06-15 23:46:45 +02:00

59 lines
1.6 KiB
Bash

#compdef home-manager
local state ret=1
_arguments \
'-A[attribute]:ATTRIBUTE:()' \
'-I[search path]:PATH:_files -/' \
'-b[backup files]:EXT:()' \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'(-h --help)'{--help,-h}'[help]' \
'(-v --verbose)'{--verbose,-v}'[verbose]' \
'(-n --dry-run)'{--dry-run,-n}'[dry run]' \
'(-f --file)'{--file,-f}'[configuration file]:FILE:_files' \
'(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \
'1: :->cmds' \
'*:: :->args' && ret=0
case "$state" in
cmds)
_values 'command' \
'help[help]' \
'edit[edit]' \
'option[inspect option]' \
'build[build]' \
'switch[switch]' \
'generations[list generations]' \
'remove-generations[remove generations]' \
'expire-generations[expire generations]' \
'packages[managed packages]' \
'news[read the news]' \
'uninstall[uninstall]' && ret=0
;;
args)
case $line[1] in
remove-generations)
_values 'generations' \
$(home-manager generations | cut -d ' ' -f 5) && ret=0
;;
build|switch)
_arguments \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'--max-jobs[max jobs]:NUM:()' \
'--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \
'--substitute[substitute]'
;;
esac
esac
return ret