From db5b4a2a69064c803fea249a0983dbbcb4564717 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Wed, 13 May 2015 13:39:25 -0700 Subject: [PATCH] respect -H in bash completion Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 64c53f6de6..0b8de0ec62 100755 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -27,7 +27,7 @@ # This order should be applied to lists, alternatives and code blocks. __docker_q() { - docker 2>/dev/null "$@" + docker ${host:+-H "$host"} 2>/dev/null "$@" } __docker_containers_all() { @@ -1182,6 +1182,7 @@ _docker() { " local main_options_with_args_glob=$(__docker_to_extglob "$main_options_with_args") + local host COMPREPLY=() local cur prev words cword @@ -1191,6 +1192,11 @@ _docker() { local counter=1 while [ $counter -lt $cword ]; do case "${words[$counter]}" in + # save host so that completion can use custom daemon + --host|-H) + (( counter++ )) + host="${words[$counter]}" + ;; $main_options_with_args_glob ) (( counter++ )) ;;