|
@@ -299,6 +299,17 @@ __docker_complete_pid() {
|
|
|
return ret
|
|
|
}
|
|
|
|
|
|
+__docker_complete_runtimes() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ emulate -L zsh
|
|
|
+ setopt extendedglob
|
|
|
+ local -a runtimes_opts
|
|
|
+ runtimes_opts=(${(ps: :)${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Runtimes: }%%$'\n'^ *}}})
|
|
|
+ _describe -t runtimes-opts "runtimes options" runtimes_opts && ret=0
|
|
|
+}
|
|
|
+
|
|
|
__docker_complete_ps_filters() {
|
|
|
[[ $PREFIX = -* ]] && return 1
|
|
|
integer ret=1
|
|
@@ -630,6 +641,602 @@ __docker_network_subcommand() {
|
|
|
return ret
|
|
|
}
|
|
|
|
|
|
+# BO node
|
|
|
+
|
|
|
+__docker_node_complete_ls_filters() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ if compset -P '*='; then
|
|
|
+ case "${${words[-1]%=*}#*=}" in
|
|
|
+ (id)
|
|
|
+ __docker_complete_nodes_ids && ret=0
|
|
|
+ ;;
|
|
|
+ (membership)
|
|
|
+ membership_opts=('accepted' 'pending' 'rejected')
|
|
|
+ _describe -t membership-opts "membership options" membership_opts && ret=0
|
|
|
+ ;;
|
|
|
+ (name)
|
|
|
+ __docker_complete_nodes_names && ret=0
|
|
|
+ ;;
|
|
|
+ (role)
|
|
|
+ role_opts=('manager' 'worker')
|
|
|
+ _describe -t role-opts "role options" role_opts && ret=0
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ _message 'value' && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ else
|
|
|
+ opts=('id' 'label' 'membership' 'name' 'role')
|
|
|
+ _describe -t filter-opts "filter options" opts -qS "=" && ret=0
|
|
|
+ fi
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_node_complete_tasks_filters() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ if compset -P '*='; then
|
|
|
+ case "${${words[-1]%=*}#*=}" in
|
|
|
+ (desired-state)
|
|
|
+ state_opts=('accepted' 'running')
|
|
|
+ _describe -t state-opts "desired state options" state_opts && ret=0
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ _message 'value' && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ else
|
|
|
+ opts=('desired-state' 'id' 'label' 'name')
|
|
|
+ _describe -t filter-opts "filter options" opts -qS "=" && ret=0
|
|
|
+ fi
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_nodes() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+ local line s
|
|
|
+ declare -a lines nodes args
|
|
|
+
|
|
|
+ type=$1; shift
|
|
|
+ filter=$1; shift
|
|
|
+ [[ $filter != "none" ]] && args=("-f $filter")
|
|
|
+
|
|
|
+ lines=(${(f)"$(_call_program commands docker $docker_options node ls $args)"})
|
|
|
+
|
|
|
+ # Parse header line to find columns
|
|
|
+ local i=1 j=1 k header=${lines[1]}
|
|
|
+ declare -A begin end
|
|
|
+ while (( j < ${#header} - 1 )); do
|
|
|
+ i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
|
|
|
+ j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
|
|
|
+ k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
|
|
|
+ begin[${header[$i,$((j-1))]}]=$i
|
|
|
+ end[${header[$i,$((j-1))]}]=$k
|
|
|
+ done
|
|
|
+ end[${header[$i,$((j-1))]}]=-1
|
|
|
+ lines=(${lines[2,-1]})
|
|
|
+
|
|
|
+ # Node ID
|
|
|
+ if [[ $type = (ids|all) ]]; then
|
|
|
+ for line in $lines; do
|
|
|
+ s="${line[${begin[ID]},${end[ID]}]%% ##}"
|
|
|
+ nodes=($nodes $s)
|
|
|
+ done
|
|
|
+ fi
|
|
|
+
|
|
|
+ # Names
|
|
|
+ if [[ $type = (names|all) ]]; then
|
|
|
+ for line in $lines; do
|
|
|
+ s="${line[${begin[NAME]},${end[NAME]}]%% ##}"
|
|
|
+ nodes=($nodes $s)
|
|
|
+ done
|
|
|
+ fi
|
|
|
+
|
|
|
+ _describe -t nodes-list "nodes" nodes "$@" && ret=0
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_nodes() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_nodes all none "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_nodes_ids() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_nodes ids none "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_nodes_names() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_nodes names none "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_pending_nodes() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_nodes all "membership=pending" "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_manager_nodes() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_nodes all "role=manager" "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_worker_nodes() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_nodes all "role=worker" "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_node_commands() {
|
|
|
+ local -a _docker_node_subcommands
|
|
|
+ _docker_node_subcommands=(
|
|
|
+ "accept:Accept a node in the swarm"
|
|
|
+ "demote:Demote a node as manager in the swarm"
|
|
|
+ "inspect:Display detailed information on one or more nodes"
|
|
|
+ "ls:List nodes in the swarm"
|
|
|
+ "promote:Promote a node as manager in the swarm"
|
|
|
+ "rm:Remove a node from the swarm"
|
|
|
+ "tasks:List tasks running on a node"
|
|
|
+ "update:Update a node"
|
|
|
+ )
|
|
|
+ _describe -t docker-node-commands "docker node command" _docker_node_subcommands
|
|
|
+}
|
|
|
+
|
|
|
+__docker_node_subcommand() {
|
|
|
+ local -a _command_args opts_help
|
|
|
+ local expl help="--help"
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ opts_help=("(: -)--help[Print usage]")
|
|
|
+
|
|
|
+ case "$words[1]" in
|
|
|
+ (accept|rm|remove)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)*:node:__docker_complete_pending_nodes" && ret=0
|
|
|
+ ;;
|
|
|
+ (demote)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)*:node:__docker_complete_manager_nodes" && ret=0
|
|
|
+ ;;
|
|
|
+ (inspect)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \
|
|
|
+ "($help -p --pretty)"{-p,--pretty}"[Print the information in a human friendly format]" \
|
|
|
+ "($help -)*:node:__docker_complete_nodes" && ret=0
|
|
|
+ ;;
|
|
|
+ (ls|list)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \
|
|
|
+ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0
|
|
|
+ case $state in
|
|
|
+ (filter-options)
|
|
|
+ __docker_node_complete_ls_filters && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
+ (promote)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)*:node:__docker_complete_worker_nodes" && ret=0
|
|
|
+ ;;
|
|
|
+ (tasks)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -a --all)"{-a,--all}"[Display all instances]" \
|
|
|
+ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \
|
|
|
+ "($help -n --no-resolve)"{-n,--no-resolve}"[Do not map IDs to Names]" \
|
|
|
+ "($help -)1:node:__docker_complete_nodes" && ret=0
|
|
|
+ case $state in
|
|
|
+ (filter-options)
|
|
|
+ __docker_node_complete_tasks_filters && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
+ (update)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help)--availability=[Availability of the node]:availability:(active pause drain)" \
|
|
|
+ "($help)--membership=[Membership of the node]:membership:(accepted rejected)" \
|
|
|
+ "($help)--role=[Role of the node]:role:(manager worker)" \
|
|
|
+ "($help -)1:node:__docker_complete_nodes" && ret=0
|
|
|
+ ;;
|
|
|
+ (help)
|
|
|
+ _arguments $(__docker_arguments) ":subcommand:__docker_node_commands" && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+# EO node
|
|
|
+
|
|
|
+# BO plugin
|
|
|
+
|
|
|
+__docker_complete_plugins() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+ local line s
|
|
|
+ declare -a lines plugins
|
|
|
+
|
|
|
+ lines=(${(f)"$(_call_program commands docker $docker_options plugin ls)"})
|
|
|
+
|
|
|
+ # Parse header line to find columns
|
|
|
+ local i=1 j=1 k header=${lines[1]}
|
|
|
+ declare -A begin end
|
|
|
+ while (( j < ${#header} - 1 )); do
|
|
|
+ i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
|
|
|
+ j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
|
|
|
+ k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
|
|
|
+ begin[${header[$i,$((j-1))]}]=$i
|
|
|
+ end[${header[$i,$((j-1))]}]=$k
|
|
|
+ done
|
|
|
+ end[${header[$i,$((j-1))]}]=-1
|
|
|
+ lines=(${lines[2,-1]})
|
|
|
+
|
|
|
+ # Name
|
|
|
+ for line in $lines; do
|
|
|
+ s="${line[${begin[NAME]},${end[NAME]}]%% ##}"
|
|
|
+ s="$s:${(l:7:: :::)${${line[${begin[TAG]},${end[TAG]}]}%% ##}}"
|
|
|
+ plugins=($plugins $s)
|
|
|
+ done
|
|
|
+
|
|
|
+ _describe -t plugins-list "plugins" plugins "$@" && ret=0
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_plugin_commands() {
|
|
|
+ local -a _docker_plugin_subcommands
|
|
|
+ _docker_plugin_subcommands=(
|
|
|
+ "disable:Disable a plugin"
|
|
|
+ "enable:Enable a plugin"
|
|
|
+ "inspect:Return low-level information about a plugin"
|
|
|
+ "install:Install a plugin"
|
|
|
+ "ls:List plugins"
|
|
|
+ "push:Push a plugin"
|
|
|
+ "rm:Remove a plugin"
|
|
|
+ "set:Change settings for a plugin"
|
|
|
+ )
|
|
|
+ _describe -t docker-plugin-commands "docker plugin command" _docker_plugin_subcommands
|
|
|
+}
|
|
|
+
|
|
|
+__docker_plugin_subcommand() {
|
|
|
+ local -a _command_args opts_help
|
|
|
+ local expl help="--help"
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ opts_help=("(: -)--help[Print usage]")
|
|
|
+
|
|
|
+ case "$words[1]" in
|
|
|
+ (disable|enable|inspect|install|ls|push|rm)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)1:plugin:__docker_complete_plugins" && ret=0
|
|
|
+ ;;
|
|
|
+ (set)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)1:plugin:__docker_complete_plugins" \
|
|
|
+ "($help-)*:key=value: " && ret=0
|
|
|
+ ;;
|
|
|
+ (help)
|
|
|
+ _arguments $(__docker_arguments) ":subcommand:__docker_plugin_commands" && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+# EO plugin
|
|
|
+
|
|
|
+# BO service
|
|
|
+
|
|
|
+__docker_service_complete_ls_filters() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ if compset -P '*='; then
|
|
|
+ case "${${words[-1]%=*}#*=}" in
|
|
|
+ (id)
|
|
|
+ __docker_complete_services_ids && ret=0
|
|
|
+ ;;
|
|
|
+ (name)
|
|
|
+ __docker_complete_services_names && ret=0
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ _message 'value' && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ else
|
|
|
+ opts=('id' 'label' 'name')
|
|
|
+ _describe -t filter-opts "filter options" opts -qS "=" && ret=0
|
|
|
+ fi
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_service_complete_tasks_filters() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ if compset -P '*='; then
|
|
|
+ case "${${words[-1]%=*}#*=}" in
|
|
|
+ (desired-state)
|
|
|
+ state_opts=('accepted' 'running')
|
|
|
+ _describe -t state-opts "desired state options" state_opts && ret=0
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ _message 'value' && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ else
|
|
|
+ opts=('desired-state' 'id' 'label' 'name')
|
|
|
+ _describe -t filter-opts "filter options" opts -qS "=" && ret=0
|
|
|
+ fi
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_services() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ integer ret=1
|
|
|
+ local line s
|
|
|
+ declare -a lines services
|
|
|
+
|
|
|
+ type=$1; shift
|
|
|
+
|
|
|
+ lines=(${(f)"$(_call_program commands docker $docker_options service ls)"})
|
|
|
+
|
|
|
+ # Parse header line to find columns
|
|
|
+ local i=1 j=1 k header=${lines[1]}
|
|
|
+ declare -A begin end
|
|
|
+ while (( j < ${#header} - 1 )); do
|
|
|
+ i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
|
|
|
+ j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
|
|
|
+ k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
|
|
|
+ begin[${header[$i,$((j-1))]}]=$i
|
|
|
+ end[${header[$i,$((j-1))]}]=$k
|
|
|
+ done
|
|
|
+ end[${header[$i,$((j-1))]}]=-1
|
|
|
+ lines=(${lines[2,-1]})
|
|
|
+
|
|
|
+ # Service ID
|
|
|
+ if [[ $type = (ids|all) ]]; then
|
|
|
+ for line in $lines; do
|
|
|
+ s="${line[${begin[ID]},${end[ID]}]%% ##}"
|
|
|
+ s="$s:${(l:7:: :::)${${line[${begin[IMAGE]},${end[IMAGE]}]}%% ##}}"
|
|
|
+ services=($services $s)
|
|
|
+ done
|
|
|
+ fi
|
|
|
+
|
|
|
+ # Names
|
|
|
+ if [[ $type = (names|all) ]]; then
|
|
|
+ for line in $lines; do
|
|
|
+ s="${line[${begin[NAME]},${end[NAME]}]%% ##}"
|
|
|
+ s="$s:${(l:7:: :::)${${line[${begin[IMAGE]},${end[IMAGE]}]}%% ##}}"
|
|
|
+ services=($services $s)
|
|
|
+ done
|
|
|
+ fi
|
|
|
+
|
|
|
+ _describe -t services-list "services" services "$@" && ret=0
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_services() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_services all "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_services_ids() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_services ids "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_complete_services_names() {
|
|
|
+ [[ $PREFIX = -* ]] && return 1
|
|
|
+ __docker_services names "$@"
|
|
|
+}
|
|
|
+
|
|
|
+__docker_service_commands() {
|
|
|
+ local -a _docker_service_subcommands
|
|
|
+ _docker_service_subcommands=(
|
|
|
+ "create:Create a new service"
|
|
|
+ "inspect:Display detailed information on one or more services"
|
|
|
+ "ls:List services"
|
|
|
+ "rm:Remove a service"
|
|
|
+ "scale:Scale one or multiple services"
|
|
|
+ "tasks:List the tasks of a service"
|
|
|
+ "update:Update a service"
|
|
|
+ )
|
|
|
+ _describe -t docker-service-commands "docker service command" _docker_service_subcommands
|
|
|
+}
|
|
|
+
|
|
|
+__docker_service_subcommand() {
|
|
|
+ local -a _command_args opts_help opts_create_update
|
|
|
+ local expl help="--help"
|
|
|
+ integer ret=1
|
|
|
+
|
|
|
+ opts_help=("(: -)--help[Print usage]")
|
|
|
+ opts_create_update=(
|
|
|
+ "($help)*--constraint=[Placement constraints]:constraint: "
|
|
|
+ "($help)--endpoint-mode=[Placement constraints]:mode:(VIP DNSRR)"
|
|
|
+ "($help)*"{-e=,--env=}"[Set environment variables]:env: "
|
|
|
+ "($help)*--label=[Service labels]:label: "
|
|
|
+ "($help)--limit-cpu=[Limit CPUs]:value: "
|
|
|
+ "($help)--limit-memory=[Limit Memory]:value: "
|
|
|
+ "($help)--mode=[Limit Memory]:mode:(global replicated)"
|
|
|
+ "($help)*"{-m=,--mount=}"[Attach a mount to the service]:mount: "
|
|
|
+ "($help)--name=[Service name]:name: "
|
|
|
+ "($help)*--network=[Network attachments]:network: "
|
|
|
+ "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: "
|
|
|
+ "($help)--replicas=[Number of tasks]:replicas: "
|
|
|
+ "($help)--reserve-cpu=[Reserve CPUs]:value: "
|
|
|
+ "($help)--reserve-memory=[Reserve Memory]:value: "
|
|
|
+ "($help)--restart-condition=[Restart when condition is met]:mode:(any none on-failure)"
|
|
|
+ "($help)--restart-delay=[Delay between restart attempts]:delay: "
|
|
|
+ "($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: "
|
|
|
+ "($help)--restart-window=[Window used to evaluate the restart policy]:window: "
|
|
|
+ "($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: "
|
|
|
+ "($help)--update-delay=[Delay between updates]:delay: "
|
|
|
+ "($help)--update-parallelism=[Maximum number of tasks updated simultaneously]:number: "
|
|
|
+ "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users"
|
|
|
+ "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories"
|
|
|
+ )
|
|
|
+
|
|
|
+ case "$words[1]" in
|
|
|
+ (create)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ $opts_create_update \
|
|
|
+ "($help -): :__docker_images" \
|
|
|
+ "($help -):command: _command_names -e" \
|
|
|
+ "($help -)*::arguments: _normal" && ret=0
|
|
|
+ ;;
|
|
|
+ (inspect)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \
|
|
|
+ "($help -p --pretty)"{-p,--pretty}"[Print the information in a human friendly format]" \
|
|
|
+ "($help -)*:service:__docker_complete_services" && ret=0
|
|
|
+ ;;
|
|
|
+ (ls|list)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:->filter-options" \
|
|
|
+ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0
|
|
|
+ case $state in
|
|
|
+ (filter-options)
|
|
|
+ __docker_service_complete_ls_filters && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
+ (rm|remove)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)*:service:__docker_complete_services" && ret=0
|
|
|
+ ;;
|
|
|
+ (scale)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -)*:service:->values" && ret=0
|
|
|
+ case $state in
|
|
|
+ (values)
|
|
|
+ if compset -P '*='; then
|
|
|
+ _message 'replicas' && ret=0
|
|
|
+ else
|
|
|
+ __docker_complete_services -qS "="
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
+ (tasks)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -a --all)"{-a,--all}"[Display all tasks]" \
|
|
|
+ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \
|
|
|
+ "($help -n --no-resolve)"{-n,--no-resolve}"[Do not map IDs to Names]" \
|
|
|
+ "($help -)1:service:__docker_complete_services" && ret=0
|
|
|
+ case $state in
|
|
|
+ (filter-options)
|
|
|
+ __docker_service_complete_tasks_filters && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
+ (update)
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ $opts_create_update \
|
|
|
+ "($help)--arg=[Service command args]:arguments: _normal" \
|
|
|
+ "($help)--command=[Service command]:command: _command_names -e" \
|
|
|
+ "($help)--image=[Service image tag]:image:__docker_repositories" \
|
|
|
+ "($help -)1:service:__docker_complete_services" && ret=0
|
|
|
+ ;;
|
|
|
+ (help)
|
|
|
+ _arguments $(__docker_arguments) ":subcommand:__docker_service_commands" && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
+# EO service
|
|
|
+
|
|
|
+# 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
|
|
@@ -933,6 +1540,7 @@ __docker_subcommand() {
|
|
|
(daemon)
|
|
|
_arguments $(__docker_arguments) \
|
|
|
$opts_help \
|
|
|
+ "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \
|
|
|
"($help)--api-cors-header=[CORS headers in the remote API]:CORS headers: " \
|
|
|
"($help)*--authorization-plugin=[Authorization plugins to load]" \
|
|
|
"($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
|
|
@@ -1162,6 +1770,23 @@ __docker_subcommand() {
|
|
|
;;
|
|
|
esac
|
|
|
;;
|
|
|
+ (node)
|
|
|
+ local curcontext="$curcontext" state
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -): :->command" \
|
|
|
+ "($help -)*:: :->option-or-argument" && ret=0
|
|
|
+
|
|
|
+ case $state in
|
|
|
+ (command)
|
|
|
+ __docker_node_commands && ret=0
|
|
|
+ ;;
|
|
|
+ (option-or-argument)
|
|
|
+ curcontext=${curcontext%:*:*}:docker-${words[-1]}:
|
|
|
+ __docker_node_subcommand && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
(pause|unpause)
|
|
|
_arguments $(__docker_arguments) \
|
|
|
$opts_help \
|
|
@@ -1251,6 +1876,7 @@ __docker_subcommand() {
|
|
|
"($help)--health-timeout=[Maximum time to allow one check to run]:time: " \
|
|
|
"($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \
|
|
|
"($help)--rm[Remove intermediate containers when it exits]" \
|
|
|
+ "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \
|
|
|
"($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \
|
|
|
"($help)--stop-signal=[Signal to kill a container]:signal:_signals" \
|
|
|
"($help)--storage-opt=[Set storage driver options per container]:storage options:->storage-opt" \
|
|
@@ -1297,6 +1923,23 @@ __docker_subcommand() {
|
|
|
;;
|
|
|
esac
|
|
|
;;
|
|
|
+ (service)
|
|
|
+ local curcontext="$curcontext" state
|
|
|
+ _arguments $(__docker_arguments) \
|
|
|
+ $opts_help \
|
|
|
+ "($help -): :->command" \
|
|
|
+ "($help -)*:: :->option-or-argument" && ret=0
|
|
|
+
|
|
|
+ case $state in
|
|
|
+ (command)
|
|
|
+ __docker_service_commands && ret=0
|
|
|
+ ;;
|
|
|
+ (option-or-argument)
|
|
|
+ curcontext=${curcontext%:*:*}:docker-${words[-1]}:
|
|
|
+ __docker_service_subcommand && ret=0
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ ;;
|
|
|
(start)
|
|
|
_arguments $(__docker_arguments) \
|
|
|
$opts_help \
|
|
@@ -1312,6 +1955,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 \
|