Files
python-vitrageclient/tools/vitrage.bash_completion
Eyal 0e8edc9949 update bash completion with new commands
Change-Id: Id9e8e2ab4d3e1ff25e3332f3db48a13b047e4c2d
2018-08-08 13:59:41 +03:00

77 lines
3.7 KiB
Plaintext
Executable File

_vitrage()
{
local cur prev words
COMPREPLY=()
_get_comp_words_by_ref -n : cur prev words
# Command data:
cmds='alarm complete event healthcheck help rca resource template topology webhook'
cmds_alarm='count history list show'
cmds_alarm_count='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --all-tenants'
cmds_alarm_history='-h --help -f --format -c --column --max-width --fit-width --print-empty --quote --noindent --sort-column --all-tenants --limit --marker --start --end'
cmds_alarm_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --quote --noindent --sort-column --all-tenants --limit --marker'
cmds_alarm_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
cmds_complete='-h --help --name --shell'
cmds_event='post'
cmds_event_post='-h --help --type --time --details'
cmds_healthcheck='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
cmds_help='-h --help'
cmds_rca='show'
cmds_rca_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --all-tenants'
cmds_resource='list show'
cmds_resource_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --quote --noindent --sort-column --type --all-tenants'
cmds_resource_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
cmds_template='add delete list show validate'
cmds_template_add='-h --help -f --format -c --column --max-width --fit-width --print-empty --quote --noindent --sort-column --path --type'
cmds_template_delete='-h --help'
cmds_template_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --quote --noindent --sort-column'
cmds_template_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
cmds_template_validate='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --path --type'
cmds_topology='show'
cmds_topology_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --filter --limit --root --graph-type --all-tenants'
cmds_webhook='add delete list show'
cmds_webhook_add='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix --url --regex_filter --headers'
cmds_webhook_delete='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
cmds_webhook_list='-h --help -f --format -c --column --max-width --fit-width --print-empty --quote --noindent --sort-column --all-tenants'
cmds_webhook_show='-h --help -f --format -c --column --max-width --fit-width --print-empty --noindent --variable --prefix'
dash=-
underscore=_
cmd=""
words[0]=""
completed="${cmds}"
for var in "${words[@]:1}"
do
if [[ ${var} == -* ]] ; then
break
fi
if [ -z "${cmd}" ] ; then
proposed="${var}"
else
proposed="${cmd}_${var}"
fi
local i="cmds_${proposed}"
i=${i//$dash/$underscore}
local comp="${!i}"
if [ -z "${comp}" ] ; then
break
fi
if [[ ${comp} == -* ]] ; then
if [[ ${cur} != -* ]] ; then
completed=""
break
fi
fi
cmd="${proposed}"
completed="${comp}"
done
if [ -z "${completed}" ] ; then
COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )
else
COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )
fi
return 0
}
complete -F _vitrage vitrage