From d2d4dbf5af340ec1449ee3ca9a10216a6d9abd7b Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Tue, 8 Aug 2017 17:56:04 +0200 Subject: [PATCH] Improve bash completion for `stack deploy` This adds completion of stack names, which is very useful when updating existing stacks. Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index ed49452744..542b0013ba 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -4331,6 +4331,12 @@ _docker_stack_deploy() { __docker_daemon_is_experimental && options+=" --bundle-file" COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) ;; + *) + local counter=$(__docker_pos_first_nonflag '--compose-file|-c|--bundle-file') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_stacks + fi + ;; esac } @@ -4408,6 +4414,7 @@ _docker_stack_rm() { ;; *) __docker_complete_stacks + ;; esac }