Skip to content

Commit

Permalink
fix bash completion for docker {swarm,node} subcommands
Browse files Browse the repository at this point in the history
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit e65f036)
  • Loading branch information
albers authored and Tibor Vass committed Jun 30, 2016
1 parent a4e3415 commit 75193e5
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions contrib/completion/bash/docker
Original file line number Diff line number Diff line change
Expand Up @@ -1737,22 +1737,40 @@ _docker_swarm() {
}

_docker_swarm_init() {
case "$prev" in
--auto-accept|--listen-addr|--secret)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--auto-accept --force-new-cluster --help --secret" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--auto-accept --force-new-cluster --help --listen-addr --secret" -- "$cur" ) )
;;
esac
}

_docker_swarm_inspect() {
case "$prev" in
--format|-f)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format --help" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) )
;;
esac
}

_docker_swarm_join() {
case "$prev" in
--ca-hash|--listen-addr|--secret)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--ca-hash --help --listen-addr --manager --secret" -- "$cur" ) )
Expand Down Expand Up @@ -1787,9 +1805,9 @@ _docker_node() {
accept
demote
inspect
ls
ls list
promote
rm
rm remove
tasks
update
"
Expand Down Expand Up @@ -1826,19 +1844,35 @@ _docker_node_demote() {
}

_docker_node_inspect() {
case "$prev" in
--format|-f)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format --help --pretty" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--format -f --help --pretty -p" -- "$cur" ) )
;;
*)
__docker_complete_nodes
esac
}

_docker_node_list() {
_docker_node_ls
}

_docker_node_ls() {
case "$prev" in
--filter|-f)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--filter --help --quiet" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) )
;;
esac
}
Expand All @@ -1853,6 +1887,10 @@ _docker_node_promote() {
esac
}

_docker_node_remove() {
_docker_node_rm
}

_docker_node_rm() {
case "$cur" in
-*)
Expand All @@ -1864,16 +1902,28 @@ _docker_node_rm() {
}

_docker_node_tasks() {
case "$prev" in
--filter|-f)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--all --filter --help --no-resolve" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve -n" -- "$cur" ) )
;;
*)
__docker_complete_nodes_plus_self
esac
}

_docker_node_update() {
case "$prev" in
--availability|--membership|--role)
return
;;
esac

case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--availability --help --membership --role" -- "$cur" ) )
Expand Down

0 comments on commit 75193e5

Please sign in to comment.