From 2082c976e8edba586899062977971d131d883dbc Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Wed, 29 Jun 2016 05:26:55 -0700 Subject: [PATCH] bash completion for default port on `docker swarm {init,join}` Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 855b866d58..1495b8541c 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1816,7 +1816,13 @@ _docker_swarm_init() { COMPREPLY=( $( compgen -W "manager none worker" -- "$cur" ) ) return ;; - --listen-addr|--secret) + --listen-addr) + if [[ $cur == *: ]] ; then + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + fi + return + ;; + --secret) return ;; esac @@ -1844,7 +1850,13 @@ _docker_swarm_inspect() { _docker_swarm_join() { case "$prev" in - --ca-hash|--listen-addr|--secret) + --ca-hash|--secret) + return + ;; + --listen-addr) + if [[ $cur == *: ]] ; then + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + fi return ;; esac @@ -1853,6 +1865,9 @@ _docker_swarm_join() { -*) COMPREPLY=( $( compgen -W "--ca-hash --help --listen-addr --manager --secret" -- "$cur" ) ) ;; + *:) + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + ;; esac }