Browse Source

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>
Harald Albers 9 years ago
parent
commit
19753ec84d
1 changed files with 86 additions and 86 deletions
  1. 86 86
      contrib/completion/bash/docker

+ 86 - 86
contrib/completion/bash/docker

@@ -1591,55 +1591,6 @@ _docker_service_create() {
 	esac
 	esac
 }
 }
 
 
-_docker_service_update() {
-	local options_with_args="
-		--arg
-		--command
-		--constraint
-		--endpoint-mode
-		--env -e
-		--image
-		--label -l
-		--limit-cpu
-		--limit-memory
-		--mode
-		--mount -m
-		--name
-		--network
-		--publish -p
-		--replicas
-		--reserve-cpu
-		--reserve-memory
-		--restart-condition
-		--restart-delay
-		--restart-max-attempts
-		--restart-window
-		--stop-grace-period
-		--update-delay
-		--update-parallelism
-		--user -u
-		--workdir -w
-	"
-
-	local boolean_options="
-		--help
-	"
-
-	case "$prev" in
-		$(__docker_to_extglob "$options_with_args") )
-			return
-			;;
-	esac
-
-	case "$cur" in
-		-*)
-			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
-			;;
-		*)
-			__docker_complete_services
-	esac
-}
-
 _docker_service_inspect() {
 _docker_service_inspect() {
 	case "$prev" in
 	case "$prev" in
 		--format|-f)
 		--format|-f)
@@ -1656,7 +1607,11 @@ _docker_service_inspect() {
 	esac
 	esac
 }
 }
 
 
-_docker_service_tasks() {
+_docker_service_list() {
+	_docker_service_ls
+}
+
+_docker_service_ls() {
 	case "$prev" in
 	case "$prev" in
 		--format|-f)
 		--format|-f)
 			return
 			return
@@ -1665,10 +1620,8 @@ _docker_service_tasks() {
 
 
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve -n" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "-f --filter --help --quiet -q" -- "$cur" ) )
 			;;
 			;;
-		*)
-			__docker_complete_services
 	esac
 	esac
 }
 }
 
 
@@ -1686,11 +1639,19 @@ _docker_service_rm() {
 	esac
 	esac
 }
 }
 
 
-_docker_service_list() {
-	_docker_service_ls
+_docker_service_scale() {
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
+			;;
+		*)
+			COMPREPLY=( $(compgen -S "=" -W "$(__docker_services $1)" -- "$cur") )
+			__docker_nospace
+			;;
+	esac
 }
 }
 
 
-_docker_service_ls() {
+_docker_service_tasks() {
 	case "$prev" in
 	case "$prev" in
 		--format|-f)
 		--format|-f)
 			return
 			return
@@ -1699,30 +1660,69 @@ _docker_service_ls() {
 
 
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "-f --filter --help --quiet -q" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve -n" -- "$cur" ) )
 			;;
 			;;
+		*)
+			__docker_complete_services
 	esac
 	esac
 }
 }
 
 
-_docker_service_scale() {
+_docker_service_update() {
+	local options_with_args="
+		--arg
+		--command
+		--constraint
+		--endpoint-mode
+		--env -e
+		--image
+		--label -l
+		--limit-cpu
+		--limit-memory
+		--mode
+		--mount -m
+		--name
+		--network
+		--publish -p
+		--replicas
+		--reserve-cpu
+		--reserve-memory
+		--restart-condition
+		--restart-delay
+		--restart-max-attempts
+		--restart-window
+		--stop-grace-period
+		--update-delay
+		--update-parallelism
+		--user -u
+		--workdir -w
+	"
+
+	local boolean_options="
+		--help
+	"
+
+	case "$prev" in
+		$(__docker_to_extglob "$options_with_args") )
+			return
+			;;
+	esac
+
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
 			;;
 			;;
 		*)
 		*)
-			COMPREPLY=( $(compgen -S "=" -W "$(__docker_services $1)" -- "$cur") )
-			__docker_nospace
-			;;
+			__docker_complete_services
 	esac
 	esac
 }
 }
 
 
 _docker_swarm() {
 _docker_swarm() {
 	local subcommands="
 	local subcommands="
 		init
 		init
+		inspect
 		join
 		join
-		update
 		leave
 		leave
-		inspect
+		update
 	"
 	"
 	__docker_subcommands "$subcommands" && return
 	__docker_subcommands "$subcommands" && return
 
 
@@ -1744,24 +1744,18 @@ _docker_swarm_init() {
 	esac
 	esac
 }
 }
 
 
-_docker_swarm_join() {
+_docker_swarm_inspect() {
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--ca-hash --help --listen-addr --manager --secret" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--format --help" -- "$cur" ) )
 			;;
 			;;
 	esac
 	esac
 }
 }
 
 
-_docker_swarm_update() {
-	case "$prev" in
-		--auto-accept|--cert-expiry|--dispatcher-heartbeat|--secret|--task-history-limit)
-			return
-			;;
-	esac
-
+_docker_swarm_join() {
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--auto-accept --cert-expiry --dispatcher-heartbeat --help --secret --task-history-limit" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--ca-hash --help --listen-addr --manager --secret" -- "$cur" ) )
 			;;
 			;;
 	esac
 	esac
 }
 }
@@ -1774,10 +1768,16 @@ _docker_swarm_leave() {
 	esac
 	esac
 }
 }
 
 
-_docker_swarm_inspect() {
+_docker_swarm_update() {
+	case "$prev" in
+		--auto-accept|--cert-expiry|--dispatcher-heartbeat|--secret|--task-history-limit)
+			return
+			;;
+	esac
+
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--format --help" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--auto-accept --cert-expiry --dispatcher-heartbeat --help --secret --task-history-limit" -- "$cur" ) )
 			;;
 			;;
 	esac
 	esac
 }
 }
@@ -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
 		-*)
 		-*)