diff options
Diffstat (limited to 'plugins/docker')
-rw-r--r-- | plugins/docker/README.md | 37 | ||||
-rw-r--r-- | plugins/docker/_docker | 41 |
2 files changed, 62 insertions, 16 deletions
diff --git a/plugins/docker/README.md b/plugins/docker/README.md index e91798485..fab7aa8f1 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -1,5 +1,34 @@ -## Docker autocomplete plugin +# Docker plugin -A copy of the completion script from the -[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker) -git repo. +This plugin adds auto-completion for [docker](https://www.docker.com/). + +To use it add `docker` to the plugins array in your zshrc file. + +```zsh +plugins=(... docker) +``` + +A copy of the completion script from the docker/cli git repo: +https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker + +## Settings + +By default, the completion doesn't allow option-stacking, meaning if you try to +complete `docker run -it <TAB>` it won't work, because you're _stacking_ the +`-i` and `-t` options. + +[You can enable it](https://github.com/docker/cli/commit/b10fb43048) by **adding +the lines below to your zshrc file**, but be aware of the side effects: + +> This enables Zsh to understand commands like `docker run -it +> ubuntu`. However, by enabling this, this also makes Zsh complete +> `docker run -u<tab>` with `docker run -uapprox` which is not valid. The +> users have to put the space or the equal sign themselves before trying +> to complete. +> +> Therefore, this behavior is disabled by default. To enable it: +> +> ``` +> zstyle ':completion:*:*:docker:*' option-stacking yes +> zstyle ':completion:*:*:docker-*:*' option-stacking yes +> ``` diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 31b83c777..7fe204313 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -1,6 +1,6 @@ #compdef docker dockerd # -# zsh completion for docker (https://docker.com) +# zsh completion for docker (http://docker.com) # # version: 0.3.0 # github: https://github.com/felixr/docker-zsh-completion @@ -9,6 +9,7 @@ # - Felix Riedel # - Steve Durrheimer # - Vincent Bernat +# - Rohan Verma # # license: # @@ -604,6 +605,7 @@ __docker_container_subcommand() { "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " "($help)*--cap-add=[Add Linux capabilities]:capability: " "($help)*--cap-drop=[Drop Linux capabilities]:capability: " + "($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: " "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " "($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " @@ -617,11 +619,13 @@ __docker_container_subcommand() { "($help)*--dns=[Custom DNS servers]:DNS server: " "($help)*--dns-option=[Custom DNS options]:DNS option: " "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " + "($help)*--domainname=[Container NIS domain name]:domainname:_hosts" "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " "($help)*--env-file=[Read environment variables from a file]:environment file:_files" "($help)*--expose=[Expose a port from the container without publishing it]: " - "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups" + "($help)*--gpus=[GPU devices to add to the container ('all' to pass all GPUs)]:device: " + "($help)*--group-add=[Set one or more supplementary user groups for the container]:group:_groups" "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" "($help)--init[Run an init inside the container that forwards signals and reaps processes]" @@ -675,6 +679,7 @@ __docker_container_subcommand() { "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " "($help)--memory-reservation=[Memory soft limit]:Memory limit: " "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " + "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" ) opts_help=("(: -)--help[Print usage]") @@ -746,6 +751,7 @@ __docker_container_subcommand() { $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)*--env-file=[Read environment variables from a file]:environment file:_files" \ "($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]" \ @@ -787,7 +793,7 @@ __docker_container_subcommand() { "($help -f --follow)"{-f,--follow}"[Follow log output]" \ "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ - "($help)--tail=[Output the last K lines]:lines:(1 10 20 50 all)" \ + "($help -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ "($help -)*:containers:__docker_complete_containers" && ret=0 ;; (ls|list) @@ -800,7 +806,7 @@ __docker_container_subcommand() { "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \ "($help -s --size)"{-s,--size}"[Display total file sizes]" \ "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 ;; @@ -831,7 +837,7 @@ __docker_container_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ - "($help -)*:containers:__docker_complete_containers_ids" && ret=0 + "($help -)*:containers:__docker_complete_containers" && ret=0 ;; (rm) local state @@ -1014,6 +1020,7 @@ __docker_image_subcommand() { "($help)*--shm-size=[Size of '/dev/shm' (format is '<number><unit>')]:shm size: " \ "($help)--squash[Squash newly built layers into a single new layer]" \ "($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_complete_repositories_with_tags" \ + "($help)--target=[Set the target build stage to build.]" \ "($help)*--ulimit=[ulimit options]:ulimit: " \ "($help)--userns=[Container user namespace]:user namespace:(host)" \ "($help -):path or URL:_directories" && ret=0 @@ -1023,7 +1030,7 @@ __docker_image_subcommand() { $opts_help \ "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -)*: :__docker_complete_images" && ret=0 ;; (import) @@ -1055,7 +1062,7 @@ __docker_image_subcommand() { "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ "($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -): :__docker_complete_repositories" && ret=0 ;; (prune) @@ -1075,6 +1082,7 @@ __docker_image_subcommand() { (push) _arguments $(__docker_arguments) \ $opts_help \ + "($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \ "($help)--disable-content-trust[Skip image signing]" \ "($help -): :__docker_complete_images" && ret=0 ;; @@ -1285,7 +1293,7 @@ __docker_network_subcommand() { "($help)--no-trunc[Do not truncate the output]" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ "($help)--format=[Pretty-print networks using a Go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0 + "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0 ;; (prune) _arguments $(__docker_arguments) \ @@ -1953,6 +1961,8 @@ __docker_service_subcommand() { opts_help=("(: -)--help[Print usage]") opts_create_update=( + "($help)*--cap-add=[Add Linux capabilities]:capability: " + "($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)*--constraint=[Placement constraints]:constraint: " "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" "($help)*"{-e=,--env=}"[Set environment variables]:env: " @@ -1965,6 +1975,7 @@ __docker_service_subcommand() { "($help)*--label=[Service labels]:label: " "($help)--limit-cpu=[Limit CPUs]:value: " "($help)--limit-memory=[Limit Memory]:value: " + "($help)--limit-pids[Limit maximum number of processes (default 0 = unlimited)]" "($help)--log-driver=[Logging driver for service]:logging driver:__docker_complete_log_drivers" "($help)*--log-opt=[Logging driver options]:log driver options:__docker_complete_log_options" "($help)*--mount=[Attach a filesystem mount to the service]:mount: " @@ -2007,6 +2018,7 @@ __docker_service_subcommand() { "($help)*--dns-option=[Set DNS options]:DNS option: " \ "($help)*--dns-search=[Set custom DNS search domains]:DNS search: " \ "($help)*--env-file=[Read environment variables from a file]:environment file:_files" \ + "($help)*--group=[Set one or more supplementary user groups for the container]:group: _groups " \ "($help)--mode=[Service Mode]:mode:(global replicated)" \ "($help)--name=[Service name]:name: " \ "($help)*--placement-pref=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ @@ -2030,7 +2042,7 @@ __docker_service_subcommand() { "($help)--no-task-ids[Do not include task IDs]" \ "($help)--no-trunc[Do not truncate output]" \ "($help)--since=[Show logs since timestamp]:timestamp: " \ - "($help)--tail=[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ + "($help -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ "($help -)1:service:__docker_complete_services" && ret=0 ;; @@ -2213,8 +2225,7 @@ __docker_stack_subcommand() { (deploy|up) _arguments $(__docker_arguments) \ $opts_help \ - "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ - "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \ + "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help -):stack:__docker_complete_stacks" && ret=0 ;; @@ -2285,6 +2296,9 @@ __docker_swarm_subcommand() { $opts_help \ "($help)--advertise-addr=[Advertised address]:ip\:port: " \ "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--data-path-port=[Data Path Port]:port " \ + "($help)--default-addr-pool=[Default address pool]" \ + "($help)--default-addr-pool-mask-length=[Default address pool subnet mask length]" \ "($help)--autolock[Enable manager autolocking]" \ "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ @@ -2632,6 +2646,8 @@ __docker_subcommand() { "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \ "($help)--config-file=[Path to daemon configuration file]:Config File:_files" \ "($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \ + "($help)--containerd-namespace=[Containerd namespace to use]:containerd namespace:" \ + "($help)--containerd-plugins-namespace=[Containerd namespace to use for plugins]:containerd namespace:" \ "($help)--data-root=[Root directory of persisted Docker data]:path:_directories" \ "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ "($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \ @@ -2664,6 +2680,7 @@ __docker_subcommand() { "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ + "($help)--max-download-attempts[Set the max download attempts for each pull]" \ "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ @@ -2779,7 +2796,7 @@ __docker_subcommand() { $opts_help \ "($help -p --password)"{-p=,--password=}"[Password]:password: " \ "($help)--password-stdin[Read password from stdin]" \ - "($help -u --user)"{-u=,--user=}"[Username]:username: " \ + "($help -u --username)"{-u=,--username=}"[Username]:username: " \ "($help -)1:server: " && ret=0 ;; (logout) |