1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #23454 from sdurrheimer/zsh-completion-create-run-pid-values

Add zsh completion for 'docker {create,run} --pid' values
This commit is contained in:
Sebastiaan van Stijn 2016-06-11 18:28:01 +02:00 committed by GitHub
commit b3ce532762

View file

@ -274,6 +274,31 @@ __docker_complete_detach_keys() {
_describe -t detach_keys-ctrl "'ctrl-' + 'a-z @ [ \\\\ ] ^ _'" ctrl_keys -qS "," && ret=0
}
__docker_complete_pid() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local -a opts vopts
opts=('host')
vopts=('container')
if compset -P '*:'; then
case "${${words[-1]%:*}#*=}" in
(container)
__docker_runningcontainers && ret=0
;;
*)
_message 'value' && ret=0
;;
esac
else
_describe -t pid-value-opts "PID Options with value" vopts -qS ":" && ret=0
_describe -t pid-opts "PID Options" opts && ret=0
fi
return ret
}
__docker_complete_ps_filters() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
@ -750,7 +775,7 @@ __docker_subcommand() {
"($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]"
"($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]"
"($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports"
"($help)--pid=[PID namespace to use]:PID namespace: "
"($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid"
"($help)--privileged[Give extended privileges to this container]"
"($help)--read-only[Mount the container's root filesystem as read only]"
"($help)*--security-opt=[Security options]:security option: "