2016-06-07 11:44:35 +00:00
|
|
|
_cdist()
|
|
|
|
{
|
|
|
|
local cur prev prevprev opts cmds projects
|
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
|
2017-07-20 20:04:44 +00:00
|
|
|
opts="-h --help -q --quiet -v --verbose -V --version"
|
2019-01-26 16:00:03 +00:00
|
|
|
cmds="banner config install inventory preos shell trigger"
|
2016-06-07 11:44:35 +00:00
|
|
|
|
|
|
|
case "${prevprev}" in
|
|
|
|
shell)
|
|
|
|
case "${prev}" in
|
|
|
|
-s|--shell)
|
|
|
|
shells=$(grep -v '^#' /etc/shells)
|
|
|
|
COMPREPLY=( $(compgen -W "${shells}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2017-07-20 20:04:44 +00:00
|
|
|
inventory)
|
|
|
|
case "${prev}" in
|
|
|
|
list)
|
|
|
|
opts="-h --help -q --quiet -v --verbose -b --beta \
|
|
|
|
-I --invento/y -a --all -f --file -H --host-only \
|
|
|
|
-t --tag"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
add-host)
|
|
|
|
opts="-h --help -q --quiet -v --verbose -b --beta \
|
|
|
|
-I --inventory -f --file"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
del-host)
|
|
|
|
opts="-h --help -q --quiet -v --verbose -b --beta \
|
|
|
|
-I --inventory -a --all -f --file"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
add-tag)
|
|
|
|
opts="-h --help -q --quiet -v --verbose -b --beta \
|
|
|
|
-I --inventory -f --file -T --tag-file -t --taglist"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
del-tag)
|
|
|
|
opts="-h --help -q --quiet -v --verbose -b --beta \
|
|
|
|
-I --inventory -a --all -f --file -T --tag-file -t --taglist"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2016-06-07 11:44:35 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
case "${prev}" in
|
|
|
|
-*)
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
banner)
|
2017-07-20 20:04:44 +00:00
|
|
|
opts="-h --help -q --quiet -v --verbose"
|
2016-06-07 11:44:35 +00:00
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
shell)
|
2017-07-20 20:04:44 +00:00
|
|
|
opts="-h --help -q --quiet -v --verbose -s --shell"
|
2016-06-07 11:44:35 +00:00
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
2016-10-13 19:40:09 +00:00
|
|
|
config|install)
|
2017-07-20 20:04:44 +00:00
|
|
|
opts="-h --help -q --quiet -v --verbose -b --beta \
|
|
|
|
-I --inventory -C --cache-path-pattern -c --conf-dir \
|
|
|
|
-f --file -i --initial-manifest -A --all-tagged \
|
|
|
|
-j --jobs -n --dry-run -o --out-dir -p --parallel \
|
|
|
|
-r --remote-out-dir \
|
|
|
|
-s --sequential --remote-copy --remote-exec -t --tag -a --all"
|
2016-06-07 11:44:35 +00:00
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
2019-01-26 16:00:03 +00:00
|
|
|
trigger)
|
|
|
|
opts="-h --help -d --debug -v --verbose -b --beta \
|
|
|
|
-C --cache-path-pattern -c --conf-dir -i --initial-manifest \
|
|
|
|
-j --jobs -n --dry-run -o --out-dir --remote-copy \
|
|
|
|
--remote-exec -6 --ipv6 -H --http-port -D --directory -S --source"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
2017-07-20 20:04:44 +00:00
|
|
|
inventory)
|
|
|
|
cmds="list add-host del-host add-tag del-tag"
|
|
|
|
opts="-h --help -q --quiet -v --verbose"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts} ${cmds}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
;;
|
2016-06-07 11:44:35 +00:00
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ ${cur} == -* ]]; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _cdist cdist
|