Merge "Add kolla-ansible bash completion script"

This commit is contained in:
Jenkins 2017-06-02 11:05:44 +00:00 committed by Gerrit Code Review
commit e8c0ed8b7e
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,21 @@
_kolla_ansible() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
kolla_ansible_opts="$(kolla-ansible bash-completion)"
kolla_ansible_flags="$(echo ${kolla_ansible_opts} | sed 's/ [^-][a-z0-9_-]*//g' )"
kolla_ansible_actions="$(echo ${kolla_ansible_opts} | sed 's/--[a-z0-9-]*//g' | sed 's/ -[a-z]//g' )"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${kolla_ansible_flags}" -- ${cur}) )
return 0
else
COMPREPLY=( $(compgen -W "${kolla_ansible_actions}" -- ${cur}) )
return 0
fi
}
complete -F _kolla_ansible -A file kolla-ansible

View File

@ -0,0 +1,4 @@
---
features:
- Add kolla-ansible bash-completion script under
contrib/bash-completion folder.

View File

@ -64,6 +64,34 @@ Commands:
EOF
}
function bash_completion {
cat <<EOF
--inventory -i
--playbook -p
--configdir
--key -k
--help -h
--tags -t
--extra -e
--passwords
--verbose -v
prechecks
check
mariadb_recovery
bootstrap-servers
destroy
deploy
deploy-bifrost
deploy-servers
post-deploy
pull
reconfigure
stop
certificates
upgrade
genconfig
EOF
}
SHORT_OPTS="hi:p:t:k:e:v"
LONG_OPTS="help,inventory:,playbook:,tags:,key:,extra:,verbose,configdir:,passwords:,yes-i-really-really-mean-it,include-images"
@ -233,6 +261,10 @@ EOF
ACTION="Generate configuration files for enabled OpenStack services"
EXTRA_OPTS="$EXTRA_OPTS -e action=config"
;;
(bash-completion)
bash_completion
exit 0
;;
(*) usage
exit 0
;;