cdist configuration management Latest manual: https://www.cdi.st/manual/latest/ Home page: https://www.cdi.st
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

77 lines
3.2 KiB

#compdef cdist
_cdist()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->opts_cmds'\
'*: :->opts'
case $state in
opts_cmds)
_arguments '1:Options and commands:(banner config install inventory preos shell -h --help -q --quiet -v --verbose -V --version)'
;;
*)
case $words[2] in
-*)
opts=(-h --help -q --quiet -v --verbose -V --version)
compadd "$@" -- $opts
;;
banner)
opts=(-h --help -q --quiet -v --verbose)
compadd "$@" -- $opts
;;
shell)
case $words[3] in
-s|--shell)
shells=($(grep -v '^#' /etc/shells))
compadd "$@" -- $shells
;;
*)
opts=(-h --help -q --quiet -v --verbose -s --shell)
compadd "$@" -- $opts
;;
esac
;;
config|install)
opts=(-h --help -q --quiet -v --verbose -a --all -b --beta -C --cache-path-pattern -c --conf-dir -f --file -i --initial-manifest -j --jobs -n --dry-run -o --out-dir -p --parallel -r --remote-out-dir -s --sequential --remote-copy --remote-exec -t --tag -I --inventory -A --all-tagged)
compadd "$@" -- $opts
;;
inventory)
case $words[3] in
list)
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -a --all -f --file -H --host-only -t --tag)
compadd "$@" -- $opts
;;
add-host)
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -f --file)
compadd "$@" -- $opts
;;
del-host)
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -a --all -f --file)
compadd "$@" -- $opts
;;
add-tag)
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -f --file -T --tag-file -t --taglist)
compadd "$@" -- $opts
;;
del-tag)
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -a --all -f --file -T --tag-file -t --taglist)
compadd "$@" -- $opts
;;
*)
cmds=(list add-host del-host add-tag del-tag)
opts=(-h --help -q --quiet -v --verbose)
compadd "$@" -- $cmds $opts
;;
esac
;;
*)
;;
esac
esac
}
_cdist "$@"