|
|
@ -48,10 +48,10 @@ _salt(){
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
if [ ${COMP_CWORD} -gt 2 ]; then
|
|
|
|
if [ ${COMP_CWORD} -gt 2 ]; then
|
|
|
|
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
|
|
|
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ ${COMP_CWORD} -gt 3 ]; then
|
|
|
|
if [ ${COMP_CWORD} -gt 3 ]; then
|
|
|
|
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
|
|
|
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
opts="-h --help -d --doc --documentation --version --versions-report -c \
|
|
|
|
opts="-h --help -d --doc --documentation --version --versions-report -c \
|
|
|
@ -71,7 +71,7 @@ _salt(){
|
|
|
|
case "${pprev}" in
|
|
|
|
case "${pprev}" in
|
|
|
|
-G|--grain|--grain-pcre)
|
|
|
|
-G|--grain|--grain-pcre)
|
|
|
|
if [ "${cur}" = ":" ]; then
|
|
|
|
if [ "${cur}" = ":" ]; then
|
|
|
|
COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" ))
|
|
|
|
COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`"))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -109,7 +109,7 @@ _salt(){
|
|
|
|
-G|--grain|--grain-pcre)
|
|
|
|
-G|--grain|--grain-pcre)
|
|
|
|
COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-C|--compound)
|
|
|
|
-C|--compound)
|
|
|
|
COMPREPLY=() # TODO: finish this one? how?
|
|
|
|
COMPREPLY=() # TODO: finish this one? how?
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
@ -123,7 +123,7 @@ _salt(){
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-N|--nodegroup)
|
|
|
|
-N|--nodegroup)
|
|
|
|
MASTER_CONFIG='/etc/salt/master'
|
|
|
|
MASTER_CONFIG='/etc/salt/master'
|
|
|
|
COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -222,7 +222,7 @@ _saltkey(){
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
--accept-all)
|
|
|
|
--accept-all)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
COMPREPLY=($(compgen -W "${opts} " -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "${opts} " -- ${cur}))
|
|
|
@ -261,19 +261,19 @@ _saltcall(){
|
|
|
|
case ${prev} in
|
|
|
|
case ${prev} in
|
|
|
|
-m|--module-dirs)
|
|
|
|
-m|--module-dirs)
|
|
|
|
COMPREPLY=( $(compgen -d ${cur} ))
|
|
|
|
COMPREPLY=( $(compgen -d ${cur} ))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
-l|--log-level)
|
|
|
|
|
|
|
|
COMPREPLY=( $(compgen -W "info none garbage trace warning error debug" -- ${cur}))
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
-g|grains)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
salt-call)
|
|
|
|
-l|--log-level)
|
|
|
|
|
|
|
|
COMPREPLY=( $(compgen -W "info none garbage trace warning error debug" -- ${cur}))
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
-g|grains)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
salt-call)
|
|
|
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
_salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )"
|
|
|
|
_salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )"
|
|
|
@ -308,46 +308,45 @@ _saltcp(){
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
case ${prev} in
|
|
|
|
case ${prev} in
|
|
|
|
salt-cp)
|
|
|
|
salt-cp)
|
|
|
|
COMPREPLY=($(compgen -W "${opts} $(_salt_get_keys acc)" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "${opts} $(_salt_get_keys acc)" -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-t|--timeout)
|
|
|
|
-t|--timeout)
|
|
|
|
# those numbers are just a hint
|
|
|
|
# those numbers are just a hint
|
|
|
|
COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} ))
|
|
|
|
COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} ))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-E|--pcre)
|
|
|
|
-E|--pcre)
|
|
|
|
COMPREPLY=($(compgen -W "$(_salt_get_keys acc)" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "$(_salt_get_keys acc)" -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-L|--list)
|
|
|
|
-L|--list)
|
|
|
|
# IMPROVEMENTS ARE WELCOME
|
|
|
|
# IMPROVEMENTS ARE WELCOME
|
|
|
|
prefpart="${cur%,*},"
|
|
|
|
prefpart="${cur%,*},"
|
|
|
|
postpart=${cur##*,}
|
|
|
|
postpart=${cur##*,}
|
|
|
|
filt="^\($(echo ${cur}| sed 's:,:\\|:g')\)$"
|
|
|
|
filt="^\($(echo ${cur}| sed 's:,:\\|:g')\)$"
|
|
|
|
helper=($(_salt_get_keys acc | grep -v "${filt}" | sed "s/^/${prefpart}/"))
|
|
|
|
helper=($(_salt_get_keys acc | grep -v "${filt}" | sed "s/^/${prefpart}/"))
|
|
|
|
COMPREPLY=($(compgen -W "${helper[*]}" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "${helper[*]}" -- ${cur}))
|
|
|
|
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-G|--grain|--grain-pcre)
|
|
|
|
-G|--grain|--grain-pcre)
|
|
|
|
|
|
|
|
COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
# FIXME
|
|
|
|
# FIXME
|
|
|
|
-R|--range)
|
|
|
|
-R|--range)
|
|
|
|
# FIXME ??
|
|
|
|
# FIXME ??
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-C|--compound)
|
|
|
|
-C|--compound)
|
|
|
|
# FIXME ??
|
|
|
|
# FIXME ??
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
-c|--config)
|
|
|
|
-c|--config)
|
|
|
|
COMPREPLY=($(compgen -f -- ${cur}))
|
|
|
|
COMPREPLY=($(compgen -f -- ${cur}))
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
# default is using opts:
|
|
|
|
# default is using opts:
|
|
|
|