add bash completion script
This patch add a script rally.bash_completion which enables auto-completion of rally CLI in bash environmnet when running: python setup.py install or python setup.py develop test: rally [tab] rally ta[tab] rally task [tab] rally task de[tab] to-do: adding a cache to bash-completion result could speed up auto-completion Change-Id: Ia4c68ccf3faea73da87a93ce64b36545d9d8411c
This commit is contained in:
parent
2c5ced4ea4
commit
7ef742af1b
1
setup.py
1
setup.py
@ -27,4 +27,5 @@ except ImportError:
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
data_files=[('/etc/bash_completion.d', ['tools/rally.bash_completion'])],
|
||||
pbr=True)
|
||||
|
18
tools/rally.bash_completion
Normal file
18
tools/rally.bash_completion
Normal file
@ -0,0 +1,18 @@
|
||||
_rally_opts="" # lazy init
|
||||
_rally_flags="" # lazy init
|
||||
_rally_opts_exp="" # lazy init
|
||||
_rally()
|
||||
{
|
||||
local cur prev rbc cflags
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
base_opts="`rally bash-completion`"
|
||||
if [ $prev == "rally" ] && [ $COMP_CWORD == "1" ] ; then
|
||||
COMPREPLY=($(compgen -W "${base_opts}" -- ${cur}))
|
||||
else
|
||||
COMPREPLY=($(compgen -W "`rally bash-completion $prev `" -- ${cur}))
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -F _rally rally
|
Loading…
Reference in New Issue
Block a user