Move zsh completion logic to new subcommand: exec

Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
This commit is contained in:
Steve Durrheimer 2016-10-29 15:48:25 +02:00 committed by Tibor Vass
parent 978fbdd9dc
commit f2cebb1b32
1 changed files with 23 additions and 24 deletions

View File

@ -649,7 +649,25 @@ __docker_container_subcommand() {
"($help -)*:containers:__docker_complete_containers" && ret=0 "($help -)*:containers:__docker_complete_containers" && ret=0
;; ;;
(exec) (exec)
__docker_subcommand && ret=0 local state
_arguments $(__docker_arguments) \
$opts_help \
$opts_attach_exec_run_start \
"($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \
"($help)*"{-e=,--env=}"[Set environment variables]:environment variable: " \
"($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \
"($help)--privileged[Give extended Linux capabilities to the command]" \
"($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \
"($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \
"($help -):containers:__docker_complete_running_containers" \
"($help -)*::command:->anycommand" && ret=0
case $state in
(anycommand)
shift 1 words
(( CURRENT-- ))
_normal && ret=0
;;
esac
;; ;;
(export) (export)
__docker_subcommand && ret=0 __docker_subcommand && ret=0
@ -1673,7 +1691,7 @@ __docker_commands() {
} }
__docker_subcommand() { __docker_subcommand() {
local -a _command_args opts_help opts_build_run opts_build_run_update opts_run opts_run_update opts_exec_run_start local -a _command_args opts_help opts_build_run opts_build_run_update opts_run opts_run_update opts_run_start
local expl help="--help" local expl help="--help"
integer ret=1 integer ret=1
@ -1697,7 +1715,7 @@ __docker_subcommand() {
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: " "($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
) )
opts_exec_run_start=( opts_run_start=(
"($help)--detach-keys=[Escape key sequence used to detach a container]:sequence:__docker_complete_detach_keys" "($help)--detach-keys=[Escape key sequence used to detach a container]:sequence:__docker_complete_detach_keys"
) )
opts_run=( opts_run=(
@ -1909,26 +1927,7 @@ __docker_subcommand() {
"($help)--format=[Format the output using the given go template]:template: " && ret=0 "($help)--format=[Format the output using the given go template]:template: " && ret=0
;; ;;
(exec) (exec)
local state __docker_container_subcommand && ret=0
_arguments $(__docker_arguments) \
$opts_help \
$opts_attach_exec_run_start \
"($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \
"($help)*"{-e=,--env=}"[Set environment variables]:environment variable: " \
"($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \
"($help)--privileged[Give extended Linux capabilities to the command]" \
"($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \
"($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \
"($help -):containers:__docker_complete_running_containers" \
"($help -)*::command:->anycommand" && ret=0
case $state in
(anycommand)
shift 1 words
(( CURRENT-- ))
_normal && ret=0
;;
esac
;; ;;
(export) (export)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
@ -2242,7 +2241,7 @@ __docker_subcommand() {
(start) (start)
_arguments $(__docker_arguments) \ _arguments $(__docker_arguments) \
$opts_help \ $opts_help \
$opts_exec_run_start \ $opts_run_start \
"($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \
"($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ "($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \
"($help -)*:containers:__docker_complete_stopped_containers" && ret=0 "($help -)*:containers:__docker_complete_stopped_containers" && ret=0