File: keystone.bash_completion

package info (click to toggle)
python-keystoneclient 1%3A0.10.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,324 kB
  • sloc: python: 20,983; sh: 334; makefile: 106
file content (27 lines) | stat: -rw-r--r-- 857 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# bash completion for openstack keystone

_keystone_opts="" # lazy init
_keystone_flags="" # lazy init
_keystone_opts_exp="" # lazy init
_keystone()
{
	local cur prev kbc
	COMPREPLY=()
	cur="${COMP_WORDS[COMP_CWORD]}"
	prev="${COMP_WORDS[COMP_CWORD-1]}"

	if [ "x$_keystone_opts" == "x" ] ; then
		kbc="`keystone bash-completion | sed -e "s/ -h / /"`"
		_keystone_opts="`echo "$kbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
		_keystone_flags="`echo " $kbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
		_keystone_opts_exp="`echo $_keystone_opts | sed -e "s/[ ]/|/g"`"
	fi

	if [[ " ${COMP_WORDS[@]} " =~ " "($_keystone_opts_exp)" " && "$prev" != "help" ]] ; then
		COMPREPLY=($(compgen -W "${_keystone_flags}" -- ${cur}))
	else
		COMPREPLY=($(compgen -W "${_keystone_opts}" -- ${cur}))
	fi
	return 0
}
complete -F _keystone keystone