Improve POSIX compatibility of bash completion

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2017-03-03 10:26:33 +01:00 committed by Tibor Vass
parent 04731761bc
commit 9f967c7050
1 changed files with 9 additions and 9 deletions

View File

@ -581,7 +581,7 @@ __docker_subcommands() {
$(__docker_to_extglob "$subcommands") ) $(__docker_to_extglob "$subcommands") )
subcommand_pos=$counter subcommand_pos=$counter
local subcommand=${words[$counter]} local subcommand=${words[$counter]}
local completions_func=_docker_${command}_${subcommand} local completions_func=_docker_${command}_${subcommand//-/_}
declare -F $completions_func >/dev/null && $completions_func declare -F $completions_func >/dev/null && $completions_func
return 0 return 0
;; ;;
@ -671,7 +671,7 @@ __docker_complete_capabilities_droppable() {
" -- "$cur" ) ) " -- "$cur" ) )
} }
__docker_complete_detach-keys() { __docker_complete_detach_keys() {
case "$prev" in case "$prev" in
--detach-keys) --detach-keys)
case "$cur" in case "$cur" in
@ -1074,7 +1074,7 @@ _docker_container() {
} }
_docker_container_attach() { _docker_container_attach() {
__docker_complete_detach-keys && return __docker_complete_detach_keys && return
case "$cur" in case "$cur" in
-*) -*)
@ -1181,7 +1181,7 @@ _docker_container_diff() {
} }
_docker_container_exec() { _docker_container_exec() {
__docker_complete_detach-keys && return __docker_complete_detach_keys && return
case "$prev" in case "$prev" in
--env|-e) --env|-e)
@ -1550,7 +1550,7 @@ _docker_container_run_and_create() {
--rm --rm
--sig-proxy=false --sig-proxy=false
" "
__docker_complete_detach-keys && return __docker_complete_detach_keys && return
fi fi
local all_options="$options_with_args $boolean_options" local all_options="$options_with_args $boolean_options"
@ -1744,7 +1744,7 @@ _docker_container_run_and_create() {
} }
_docker_container_start() { _docker_container_start() {
__docker_complete_detach-keys && return __docker_complete_detach_keys && return
case "$prev" in case "$prev" in
--checkpoint) --checkpoint)
@ -3247,7 +3247,7 @@ _docker_swarm_join() {
esac esac
} }
_docker_swarm_join-token() { _docker_swarm_join_token() {
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) )
@ -3277,7 +3277,7 @@ _docker_swarm_unlock() {
esac esac
} }
_docker_swarm_unlock-key() { _docker_swarm_unlock_key() {
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) )
@ -4441,7 +4441,7 @@ _docker() {
command_pos=0 command_pos=0
fi fi
local completions_func=_docker_${command} local completions_func=_docker_${command//-/_}
declare -F $completions_func >/dev/null && $completions_func declare -F $completions_func >/dev/null && $completions_func
eval "$previous_extglob_setting" eval "$previous_extglob_setting"