Replace - with _ in bash completion identifiers.

Signed-off-by: Ben Hamill <git-commits@benhamill.com>
This commit is contained in:
Ben Hamill 2015-11-17 15:15:00 -06:00
parent 537f89e775
commit 5707b38a9e
3 changed files with 28 additions and 28 deletions

View File

@ -8,7 +8,7 @@
# source /some/where/docker-machine-prompt.bash # source /some/where/docker-machine-prompt.bash
# 1b. Alternatively, just copy this file into into /etc/bash_completion.d # 1b. Alternatively, just copy this file into into /etc/bash_completion.d
# 2. Change your PS1 to call __docker-machine-ps1 as command-substitution # 2. Change your PS1 to call __docker-machine-ps1 as command-substitution
# PS1='[\u@\h \W$(__docker-machine-ps1 " [%s]")]\$ ' # PS1='[\u@\h \W$(__docker_machine_ps1 " [%s]")]\$ '
# #
# Configuration: # Configuration:
# #
@ -17,7 +17,7 @@
# so use with care. # so use with care.
# #
__docker-machine-ps1 () { __docker_machine_ps1 () {
local format=${1:- [%s]} local format=${1:- [%s]}
if test ${DOCKER_MACHINE_NAME}; then if test ${DOCKER_MACHINE_NAME}; then
local status local status

View File

@ -19,7 +19,7 @@
: ${DOCKER_MACHINE_WRAPPED:=true} : ${DOCKER_MACHINE_WRAPPED:=true}
__docker-machine-wrapper () { __docker_machine_wrapper () {
if [[ "$1" == use ]]; then if [[ "$1" == use ]]; then
# Special use wrapper # Special use wrapper
shift 1 shift 1
@ -52,5 +52,5 @@ EOF
} }
if [[ ${DOCKER_MACHINE_WRAPPED} = true ]]; then if [[ ${DOCKER_MACHINE_WRAPPED} = true ]]; then
alias docker-machine=__docker-machine-wrapper alias docker-machine=__docker_machine_wrapper
fi fi

View File

@ -14,7 +14,7 @@
# . ~/.docker-machine-completion.sh # . ~/.docker-machine-completion.sh
# #
_docker-machine-active() { _docker_machine_active() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--swarm --help" -- "${cur}")) COMPREPLY=($(compgen -W "--swarm --help" -- "${cur}"))
else else
@ -22,7 +22,7 @@ _docker-machine-active() {
fi fi
} }
_docker-machine-config() { _docker_machine_config() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--swarm --help" -- "${cur}")) COMPREPLY=($(compgen -W "--swarm --help" -- "${cur}"))
else else
@ -30,12 +30,12 @@ _docker-machine-config() {
fi fi
} }
_docker-machine-create() { _docker_machine_create() {
# cheating, b/c there are approximately one zillion options to create # cheating, b/c there are approximately one zillion options to create
COMPREPLY=($(compgen -W "$(docker-machine create --help | grep '^ -' | sed 's/^ //; s/[^a-z0-9-].*$//')" -- "${cur}")) COMPREPLY=($(compgen -W "$(docker-machine create --help | grep '^ -' | sed 's/^ //; s/[^a-z0-9-].*$//')" -- "${cur}"))
} }
_docker-machine-env() { _docker_machine_env() {
case "${prev}" in case "${prev}" in
--shell) --shell)
# What are the options for --shell? # What are the options for --shell?
@ -51,7 +51,7 @@ _docker-machine-env() {
} }
# See docker-machine-wrapper.bash for the use command # See docker-machine-wrapper.bash for the use command
_docker-machine-use() { _docker_machine_use() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--swarm --unset --help" -- "${cur}")) COMPREPLY=($(compgen -W "--swarm --unset --help" -- "${cur}"))
else else
@ -59,7 +59,7 @@ _docker-machine-use() {
fi fi
} }
_docker-machine-inspect() { _docker_machine_inspect() {
case "${prev}" in case "${prev}" in
-f|--format) -f|--format)
COMPREPLY=() COMPREPLY=()
@ -74,7 +74,7 @@ _docker-machine-inspect() {
esac esac
} }
_docker-machine-ip() { _docker_machine_ip() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -82,7 +82,7 @@ _docker-machine-ip() {
fi fi
} }
_docker-machine-kill() { _docker_machine_kill() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -90,7 +90,7 @@ _docker-machine-kill() {
fi fi
} }
_docker-machine-ls() { _docker_machine_ls() {
case "${prev}" in case "${prev}" in
--filter) --filter)
COMPREPLY=() COMPREPLY=()
@ -101,7 +101,7 @@ _docker-machine-ls() {
esac esac
} }
_docker-machine-regenerate-certs() { _docker_machine_regenerate_certs() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help --force" -- "${cur}")) COMPREPLY=($(compgen -W "--help --force" -- "${cur}"))
else else
@ -109,7 +109,7 @@ _docker-machine-regenerate-certs() {
fi fi
} }
_docker-machine-restart() { _docker_machine_restart() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -117,7 +117,7 @@ _docker-machine-restart() {
fi fi
} }
_docker-machine-rm() { _docker_machine_rm() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help --force" -- "${cur}")) COMPREPLY=($(compgen -W "--help --force" -- "${cur}"))
else else
@ -126,7 +126,7 @@ _docker-machine-rm() {
fi fi
} }
_docker-machine-ssh() { _docker_machine_ssh() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -134,7 +134,7 @@ _docker-machine-ssh() {
fi fi
} }
_docker-machine-scp() { _docker_machine_scp() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help --recursive" -- "${cur}")) COMPREPLY=($(compgen -W "--help --recursive" -- "${cur}"))
else else
@ -145,7 +145,7 @@ _docker-machine-scp() {
fi fi
} }
_docker-machine-start() { _docker_machine_start() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -153,7 +153,7 @@ _docker-machine-start() {
fi fi
} }
_docker-machine-status() { _docker_machine_status() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -161,7 +161,7 @@ _docker-machine-status() {
fi fi
} }
_docker-machine-stop() { _docker_machine_stop() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -169,7 +169,7 @@ _docker-machine-stop() {
fi fi
} }
_docker-machine-upgrade() { _docker_machine_upgrade() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -177,7 +177,7 @@ _docker-machine-upgrade() {
fi fi
} }
_docker-machine-url() { _docker_machine_url() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -185,7 +185,7 @@ _docker-machine-url() {
fi fi
} }
_docker-machine-help() { _docker_machine_help() {
if [[ "${cur}" == -* ]]; then if [[ "${cur}" == -* ]]; then
COMPREPLY=($(compgen -W "--help" -- "${cur}")) COMPREPLY=($(compgen -W "--help" -- "${cur}"))
else else
@ -193,7 +193,7 @@ _docker-machine-help() {
fi fi
} }
_docker-machine-docker-machine() { _docker_machine_docker_machine() {
if [[ " ${wants_file[*]} " =~ " ${prev} " ]]; then if [[ " ${wants_file[*]} " =~ " ${prev} " ]]; then
_filedir _filedir
elif [[ " ${wants_dir[*]} " =~ " ${prev} " ]]; then elif [[ " ${wants_dir[*]} " =~ " ${prev} " ]]; then
@ -205,7 +205,7 @@ _docker-machine-docker-machine() {
fi fi
} }
_docker-machine() { _docker_machine() {
COMPREPLY=() COMPREPLY=()
local commands=(active config create env inspect ip kill ls regenerate-certs restart rm ssh scp start status stop upgrade url help) local commands=(active config create env inspect ip kill ls regenerate-certs restart rm ssh scp start status stop upgrade url help)
@ -233,7 +233,7 @@ _docker-machine() {
fi fi
done done
local completion_func=_docker-machine-"${command}" local completion_func=_docker_machine_"${command//-/_}"
if declare -F "${completion_func}" > /dev/null; then if declare -F "${completion_func}" > /dev/null; then
${completion_func} ${completion_func}
fi fi
@ -241,4 +241,4 @@ _docker-machine() {
return 0 return 0
} }
complete -F _docker-machine docker-machine complete -F _docker_machine docker-machine