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