Debian Codegraph @

tools/heat.bash_completion

raw
1 # bash completion for openstack heat
2
3 _heat_opts="" # lazy init
4 _heat_flags="" # lazy init
5 _heat_opts_exp="" # lazy init
6 _heat()
7 {
8 local cur prev kbc
9 COMPREPLY=()
10 cur="${COMP_WORDS[COMP_CWORD]}"
11 prev="${COMP_WORDS[COMP_CWORD-1]}"
12
13 if [ "x$_heat_opts" == "x" ] ; then
14 kbc="`heat bash-completion | sed -e "s/ -h / /"`"
15 _heat_opts="`echo "$kbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
16 _heat_flags="`echo " $kbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
17 _heat_opts_exp="`echo $_heat_opts | sed -e "s/[ ]/|/g"`"
18 fi
19
20 if [[ " ${COMP_WORDS[@]} " =~ " "($_heat_opts_exp)" " && "$prev" != "help" ]] ; then
21 COMPREPLY=($(compgen -W "${_heat_flags}" -- ${cur}))
22 else
23 COMPREPLY=($(compgen -W "${_heat_opts}" -- ${cur}))
24 fi
25 return 0
26 }
27 complete -o default -F _heat heat