| 1 |
#compdef cdist |
| 2 |
|
| 3 |
_cdist() |
| 4 |
{ |
| 5 |
local curcontext="$curcontext" state line |
| 6 |
typeset -A opt_args |
| 7 |
|
| 8 |
_arguments \ |
| 9 |
'1: :->opts_cmds'\ |
| 10 |
'*: :->opts' |
| 11 |
|
| 12 |
case $state in |
| 13 |
opts_cmds) |
| 14 |
_arguments '1:Options and commands:(banner config install inventory preos shell -h --help -q --quiet -v --verbose -V --version)' |
| 15 |
;; |
| 16 |
*) |
| 17 |
case $words[2] in |
| 18 |
-*) |
| 19 |
opts=(-h --help -q --quiet -v --verbose -V --version) |
| 20 |
compadd "$@" -- $opts |
| 21 |
;; |
| 22 |
banner) |
| 23 |
opts=(-h --help -q --quiet -v --verbose) |
| 24 |
compadd "$@" -- $opts |
| 25 |
;; |
| 26 |
shell) |
| 27 |
case $words[3] in |
| 28 |
-s|--shell) |
| 29 |
shells=($(grep -v '^#' /etc/shells)) |
| 30 |
compadd "$@" -- $shells |
| 31 |
;; |
| 32 |
*) |
| 33 |
opts=(-h --help -q --quiet -v --verbose -s --shell) |
| 34 |
compadd "$@" -- $opts |
| 35 |
;; |
| 36 |
esac |
| 37 |
;; |
| 38 |
config|install) |
| 39 |
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) |
| 40 |
compadd "$@" -- $opts |
| 41 |
;; |
| 42 |
inventory) |
| 43 |
case $words[3] in |
| 44 |
list) |
| 45 |
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -a --all -f --file -H --host-only -t --tag) |
| 46 |
compadd "$@" -- $opts |
| 47 |
;; |
| 48 |
add-host) |
| 49 |
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -f --file) |
| 50 |
compadd "$@" -- $opts |
| 51 |
;; |
| 52 |
del-host) |
| 53 |
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -a --all -f --file) |
| 54 |
compadd "$@" -- $opts |
| 55 |
;; |
| 56 |
add-tag) |
| 57 |
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -f --file -T --tag-file -t --taglist) |
| 58 |
compadd "$@" -- $opts |
| 59 |
;; |
| 60 |
del-tag) |
| 61 |
opts=(-h --help -q --quiet -v --verbose -b --beta -I --inventory -a --all -f --file -T --tag-file -t --taglist) |
| 62 |
compadd "$@" -- $opts |
| 63 |
;; |
| 64 |
*) |
| 65 |
cmds=(list add-host del-host add-tag del-tag) |
| 66 |
opts=(-h --help -q --quiet -v --verbose) |
| 67 |
compadd "$@" -- $cmds $opts |
| 68 |
;; |
| 69 |
esac |
| 70 |
;; |
| 71 |
*) |
| 72 |
;; |
| 73 |
esac |
| 74 |
esac |
| 75 |
} |
| 76 |
|
| 77 |
_cdist "$@" |