mirror of https://github.com/docker/cli.git
Add zsh completion for 'docker swarm' commands
Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
This commit is contained in:
parent
825b9a3b33
commit
e31b0e691a
|
@ -848,6 +848,74 @@ __docker_node_subcommand() {
|
|||
|
||||
# EO node
|
||||
|
||||
# BO swarm
|
||||
|
||||
__docker_swarm_commands() {
|
||||
local -a _docker_swarm_subcommands
|
||||
_docker_swarm_subcommands=(
|
||||
"init:Initialize a Swarm"
|
||||
"inspect:Inspect the Swarm"
|
||||
"join:Join a Swarm as a node and/or manager"
|
||||
"leave:Leave a Swarm"
|
||||
"update:Update the Swarm"
|
||||
)
|
||||
_describe -t docker-swarm-commands "docker swarm command" _docker_swarm_subcommands
|
||||
}
|
||||
|
||||
__docker_swarm_subcommand() {
|
||||
local -a _command_args opts_help
|
||||
local expl help="--help"
|
||||
integer ret=1
|
||||
|
||||
opts_help=("(: -)--help[Print usage]")
|
||||
|
||||
case "$words[1]" in
|
||||
(init)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)--auto-accept=[Acceptance policy]:policy:(manager none worker)" \
|
||||
"($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \
|
||||
"($help)--force-new-cluster[Force create a new cluster from current state]" \
|
||||
"($help)--listen-addr[Listen address]:ip\:port: " \
|
||||
"($help)--secret[Set secret value needed to accept nodes into cluster]:secret: " && ret=0
|
||||
;;
|
||||
(inspect)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
|
||||
;;
|
||||
(join)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)--ca-hash=[Hash of the Root Certificate Authority certificate used for trusted join]:hash: " \
|
||||
"($help)--listen-addr[Listen address]:ip\:port: " \
|
||||
"($help)--manager[Try joining as a manager]" \
|
||||
"($help)--secret[Secret for node acceptance]:secret: " \
|
||||
"($help -):host\:port: " && ret=0
|
||||
;;
|
||||
(leave)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help && ret=0
|
||||
;;
|
||||
(update)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)--auto-accept=[Acceptance policy]:policy:(manager none worker)" \
|
||||
"($help)--cert-expiry=[Validity period for node certificates]:duration: " \
|
||||
"($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \
|
||||
"($help)--secret[Set secret value needed to accept nodes into cluster]:secret: " \
|
||||
"($help)--task-history-limit[Task history retention limit]:limit: " && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# EO swarm
|
||||
|
||||
__docker_volume_complete_ls_filters() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
|
@ -1547,6 +1615,23 @@ __docker_subcommand() {
|
|||
"($help)--no-stream[Disable streaming stats and only pull the first result]" \
|
||||
"($help -)*:containers:__docker_runningcontainers" && ret=0
|
||||
;;
|
||||
(swarm)
|
||||
local curcontext="$curcontext" state
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help -): :->command" \
|
||||
"($help -)*:: :->option-or-argument" && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__docker_swarm_commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*:*}:docker-${words[-1]}:
|
||||
__docker_swarm_subcommand && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(tag)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
|
|
Loading…
Reference in New Issue