correct sort order in new bash completions

The completion for the new `docker service`, `docker swarm` and
`docker node` command families were partly added in non-alphabetical
order.

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2016-06-18 09:52:02 -07:00
parent 5cf73a47f5
commit 19753ec84d

View file

@ -1591,6 +1591,82 @@ _docker_service_create() {
esac esac
} }
_docker_service_inspect() {
case "$prev" in
--format|-f)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format -f --help --pretty -p" -- "$cur" ) )
;;
*)
__docker_complete_services
esac
}
_docker_service_list() {
_docker_service_ls
}
_docker_service_ls() {
case "$prev" in
--format|-f)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-f --filter --help --quiet -q" -- "$cur" ) )
;;
esac
}
_docker_service_remove() {
_docker_service_rm
}
_docker_service_rm() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_complete_services
esac
}
_docker_service_scale() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
COMPREPLY=( $(compgen -S "=" -W "$(__docker_services $1)" -- "$cur") )
__docker_nospace
;;
esac
}
_docker_service_tasks() {
case "$prev" in
--format|-f)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve -n" -- "$cur" ) )
;;
*)
__docker_complete_services
esac
}
_docker_service_update() { _docker_service_update() {
local options_with_args=" local options_with_args="
--arg --arg
@ -1640,89 +1716,13 @@ _docker_service_update() {
esac esac
} }
_docker_service_inspect() {
case "$prev" in
--format|-f)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format -f --help --pretty -p" -- "$cur" ) )
;;
*)
__docker_complete_services
esac
}
_docker_service_tasks() {
case "$prev" in
--format|-f)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve -n" -- "$cur" ) )
;;
*)
__docker_complete_services
esac
}
_docker_service_remove() {
_docker_service_rm
}
_docker_service_rm() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_complete_services
esac
}
_docker_service_list() {
_docker_service_ls
}
_docker_service_ls() {
case "$prev" in
--format|-f)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-f --filter --help --quiet -q" -- "$cur" ) )
;;
esac
}
_docker_service_scale() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
COMPREPLY=( $(compgen -S "=" -W "$(__docker_services $1)" -- "$cur") )
__docker_nospace
;;
esac
}
_docker_swarm() { _docker_swarm() {
local subcommands=" local subcommands="
init init
join
update
leave
inspect inspect
join
leave
update
" "
__docker_subcommands "$subcommands" && return __docker_subcommands "$subcommands" && return
@ -1744,6 +1744,14 @@ _docker_swarm_init() {
esac esac
} }
_docker_swarm_inspect() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format --help" -- "$cur" ) )
;;
esac
}
_docker_swarm_join() { _docker_swarm_join() {
case "$cur" in case "$cur" in
-*) -*)
@ -1752,6 +1760,14 @@ _docker_swarm_join() {
esac esac
} }
_docker_swarm_leave() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--force --help" -- "$cur" ) )
;;
esac
}
_docker_swarm_update() { _docker_swarm_update() {
case "$prev" in case "$prev" in
--auto-accept|--cert-expiry|--dispatcher-heartbeat|--secret|--task-history-limit) --auto-accept|--cert-expiry|--dispatcher-heartbeat|--secret|--task-history-limit)
@ -1766,22 +1782,6 @@ _docker_swarm_update() {
esac esac
} }
_docker_swarm_leave() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--force --help" -- "$cur" ) )
;;
esac
}
_docker_swarm_inspect() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format --help" -- "$cur" ) )
;;
esac
}
_docker_node() { _docker_node() {
local subcommands=" local subcommands="
accept accept
@ -1815,6 +1815,16 @@ _docker_node_accept() {
esac esac
} }
_docker_node_demote() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_complete_manager_nodes
esac
}
_docker_node_inspect() { _docker_node_inspect() {
case "$cur" in case "$cur" in
-*) -*)
@ -1843,16 +1853,6 @@ _docker_node_promote() {
esac esac
} }
_docker_node_demote() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
;;
*)
__docker_complete_manager_nodes
esac
}
_docker_node_rm() { _docker_node_rm() {
case "$cur" in case "$cur" in
-*) -*)