ce212218cf
Unlike NovaClient or other Clients in OpenStack, there is no space append after command in Heat Client. That means if I try to run 'heat stack-delete', I have to manually append the space and then append the thing I want to delete. This correction will help Heat Client to be more convenient for operators. Change-Id: I229653f0a1ecc2794cdb8006c22a70882084d7e1
28 lines
870 B
Plaintext
28 lines
870 B
Plaintext
# bash completion for openstack heat
|
|
|
|
_heat_opts="" # lazy init
|
|
_heat_flags="" # lazy init
|
|
_heat_opts_exp="" # lazy init
|
|
_heat()
|
|
{
|
|
local cur prev kbc
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
if [ "x$_heat_opts" == "x" ] ; then
|
|
kbc="`heat bash-completion | sed -e "s/ -h / /"`"
|
|
_heat_opts="`echo "$kbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
|
|
_heat_flags="`echo " $kbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
|
|
_heat_opts_exp="`echo $_heat_opts | sed -e "s/[ ]/|/g"`"
|
|
fi
|
|
|
|
if [[ " ${COMP_WORDS[@]} " =~ " "($_heat_opts_exp)" " && "$prev" != "help" ]] ; then
|
|
COMPREPLY=($(compgen -W "${_heat_flags}" -- ${cur}))
|
|
else
|
|
COMPREPLY=($(compgen -W "${_heat_opts}" -- ${cur}))
|
|
fi
|
|
return 0
|
|
}
|
|
complete -o default -F _heat heat
|