python-vitrageclient/tools/vitrage.bash_completion
Eyal c293cbd2d5 add a new service list api
Story: 2004897
Task: 29205
Change-Id: Iecb2ae810dd2a6a6b544c2ed7dbfe6288f393178
2019-02-12 14:31:14 +02:00

80 lines
4.0 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 service template topology webhook'
cmds_alarm='count history list show'
cmds_alarm_count='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --all-tenants'
cmds_alarm_history='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --all-tenants --limit --marker --start --end'
cmds_alarm_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --all-tenants --limit --marker'
cmds_alarm_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
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 --noindent --variable --prefix --max-width --fit-width --print-empty'
cmds_help='-h --help'
cmds_rca='show'
cmds_rca_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --all-tenants'
cmds_resource='count list show'
cmds_resource_count='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --type --all-tenants --filter --group-by'
cmds_resource_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --type --all-tenants --filter'
cmds_resource_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
cmds_service='list'
cmds_service_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column'
cmds_template='add delete list show validate'
cmds_template_add='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --path --type'
cmds_template_delete='-h --help'
cmds_template_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column'
cmds_template_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
cmds_template_validate='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --path --type'
cmds_topology='show'
cmds_topology_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --filter --limit --root --graph-type --all-tenants'
cmds_webhook='add delete list show'
cmds_webhook_add='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --url --regex_filter --headers'
cmds_webhook_delete='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
cmds_webhook_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --all-tenants'
cmds_webhook_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
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