Merge pull request #10936 from vincentbernat/fix/zsh-completion-update-3

zsh: update zsh completion for docker command
This commit is contained in:
Jessie Frazelle 2015-02-23 16:01:59 -08:00
commit 09c4b45712
2 changed files with 44 additions and 10 deletions

View File

@ -0,0 +1,3 @@
Tianon Gravi <admwiggin@gmail.com> (@tianon)
Jessie Frazelle <jess@docker.com> (@jfrazelle)
Vincent Bernat <vincent@bernat.im> (@vincentbernat)

View File

@ -197,8 +197,10 @@ __docker_subcommand () {
;; ;;
(build) (build)
_arguments \ _arguments \
{-f,--file=-}'[Dockerfile to use]:Dockerfile:_files' \
'--force-rm[Always remove intermediate containers]' \ '--force-rm[Always remove intermediate containers]' \
'--no-cache[Do not use cache when building the image]' \ '--no-cache[Do not use cache when building the image]' \
'--pull[Attempt to pull a newer version of the image]' \
{-q,--quiet}'[Suppress verbose build output]' \ {-q,--quiet}'[Suppress verbose build output]' \
'--rm[Remove intermediate containers after a successful build]' \ '--rm[Remove intermediate containers after a successful build]' \
{-t,--tag=-}'[Repository, name and tag to be applied]:repository:__docker_repositories_with_tags' \ {-t,--tag=-}'[Repository, name and tag to be applied]:repository:__docker_repositories_with_tags' \
@ -209,7 +211,6 @@ __docker_subcommand () {
{-a,--author=-}'[Author]:author: ' \ {-a,--author=-}'[Author]:author: ' \
{-m,--message=-}'[Commit message]:message: ' \ {-m,--message=-}'[Commit message]:message: ' \
{-p,--pause}'[Pause container during commit]' \ {-p,--pause}'[Pause container during commit]' \
'--run=-[Configuration automatically applied when the image is run]:configuration: ' \
':container:__docker_containers' \ ':container:__docker_containers' \
':repository:__docker_repositories_with_tags' ':repository:__docker_repositories_with_tags'
;; ;;
@ -232,15 +233,28 @@ __docker_subcommand () {
;; ;;
(events) (events)
_arguments \ _arguments \
'*'{-f,--filter=-}'[Filter values]:filter: ' \
'--since=-[Events created since this timestamp]:timestamp: ' \ '--since=-[Events created since this timestamp]:timestamp: ' \
'--until=-[Events created until this timestamp]:timestamp: ' '--until=-[Events created until this timestamp]:timestamp: '
;; ;;
(exec) (exec)
local state ret
_arguments \ _arguments \
{-d,--detach}'[Detached mode: leave the container running in the background]' \ {-d,--detach}'[Detached mode: leave the container running in the background]' \
{-i,--interactive}'[Keep stdin open even if not attached]' \ {-i,--interactive}'[Keep stdin open even if not attached]' \
{-t,--tty}'[Allocate a pseudo-tty]' \ {-t,--tty}'[Allocate a pseudo-tty]' \
':containers:__docker_runningcontainers' ':containers:__docker_runningcontainers' \
'*::command:->anycommand' && ret=0
case $state in
(anycommand)
shift 1 words
(( CURRENT-- ))
_normal
;;
esac
return ret
;; ;;
(history) (history)
_arguments \ _arguments \
@ -254,8 +268,6 @@ __docker_subcommand () {
'*'{-f,--filter=-}'[Filter values]:filter: ' \ '*'{-f,--filter=-}'[Filter values]:filter: ' \
'--no-trunc[Do not truncate output]' \ '--no-trunc[Do not truncate output]' \
{-q,--quiet}'[Only show numeric IDs]' \ {-q,--quiet}'[Only show numeric IDs]' \
'--tree[Output graph in tree format]' \
'--viz[Output graph in graphviz format]' \
':repository:__docker_repositories' ':repository:__docker_repositories'
;; ;;
(inspect) (inspect)
@ -287,7 +299,7 @@ __docker_subcommand () {
;; ;;
(load) (load)
_arguments \ _arguments \
{-i,--input=-}'[Read from tar archive file]:tar:_files' {-i,--input=-}'[Read from tar archive file]:archive file:_files -g "*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)"'
;; ;;
(login) (login)
_arguments \ _arguments \
@ -304,6 +316,7 @@ __docker_subcommand () {
_arguments \ _arguments \
{-f,--follow}'[Follow log output]' \ {-f,--follow}'[Follow log output]' \
{-t,--timestamps}'[Show timestamps]' \ {-t,--timestamps}'[Show timestamps]' \
'--tail=-[Output the last K lines]:lines:(1 10 20 50 all)' \
'*:containers:__docker_containers' '*:containers:__docker_containers'
;; ;;
(port) (port)
@ -321,6 +334,10 @@ __docker_subcommand () {
{-i,--interactive}'[Attach container'"'"'s stding]' \ {-i,--interactive}'[Attach container'"'"'s stding]' \
'*:containers:__docker_stoppedcontainers' '*:containers:__docker_stoppedcontainers'
;; ;;
(stats)
_arguments \
'*:containers:__docker_runningcontainers'
;;
(rm) (rm)
_arguments \ _arguments \
{-f,--force}'[Force removal]' \ {-f,--force}'[Force removal]' \
@ -391,7 +408,7 @@ __docker_subcommand () {
'*--lxc-conf=-[Add custom lxc options]:lxc options: ' \ '*--lxc-conf=-[Add custom lxc options]:lxc options: ' \
'-m[Memory limit (in bytes)]:limit: ' \ '-m[Memory limit (in bytes)]:limit: ' \
'--name=-[Container name]:name: ' \ '--name=-[Container name]:name: ' \
'--net=-[Network mode]:network mode:(bridge none container: host)' \ '--net=-[Network mode]:network mode:(bridge none container host)' \
{-P,--publish-all}'[Publish all exposed ports]' \ {-P,--publish-all}'[Publish all exposed ports]' \
'*'{-p,--publish=-}'[Expose a container'"'"'s port to the host]:port:_ports' \ '*'{-p,--publish=-}'[Expose a container'"'"'s port to the host]:port:_ports' \
'--privileged[Give extended privileges to this container]' \ '--privileged[Give extended privileges to this container]' \
@ -419,19 +436,33 @@ __docker_subcommand () {
esac esac
;; ;;
(pull|search) (pull)
_arguments ':name:__docker_search' _arguments \
{-a,--all-tags}'[Download all tagged images]' \
':name:__docker_search'
;; ;;
(push) (push)
_arguments ':images:__docker_images' _arguments ':images:__docker_images'
;; ;;
(rename)
_arguments \
':old name:__docker_containers' \
':new name: '
;;
(save) (save)
_arguments \ _arguments \
{-o,--output=-}'[Write to file]:file:_files' \ {-o,--output=-}'[Write to file]:file:_files' \
':images:__docker_images' '*:images:__docker_images'
;;
(search)
_arguments \
'--automated[Only show automated builds]' \
'--no-trunc[Do not truncate output]' \
{-s,--stars=-}'[Only display with at least X stars]:stars:(0 10 100 1000)' \
':term: '
;; ;;
(wait) (wait)
_arguments ':containers:__docker_runningcontainers' _arguments '*:containers:__docker_runningcontainers'
;; ;;
(help) (help)
_arguments ':subcommand:__docker_commands' _arguments ':subcommand:__docker_commands'