84e90669847771344ec949c4c2a775882c519624

Author
Andrew Matheny <andrew.j.matheny@gmail.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Update docker-compose autocompletion (#6607)

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose
  2index 2947cef382438d9cc8a8417cac3c64cd34db4268..c0a54cced1bf37b431d69001c7fb869de00debb8 100644
  3--- a/plugins/docker-compose/_docker-compose
  4+++ b/plugins/docker-compose/_docker-compose
  5@@ -3,11 +3,6 @@
  6 # Description
  7 # -----------
  8 #  zsh completion for docker-compose
  9-#  https://github.com/sdurrheimer/docker-compose-zsh-completion
 10-# -------------------------------------------------------------------------
 11-# Version
 12-# -------
 13-#  1.5.0
 14 # -------------------------------------------------------------------------
 15 # Authors
 16 # -------
 17@@ -199,7 +194,9 @@ __docker-compose_subcommand() {
 18         (build)
 19             _arguments \
 20                 $opts_help \
 21+                "*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
 22                 '--force-rm[Always remove intermediate containers.]' \
 23+                '--memory[Memory limit for the build container.]' \
 24                 '--no-cache[Do not use cache when building the image.]' \
 25                 '--pull[Always attempt to pull a newer version of the image.]' \
 26                 '*:services:__docker-compose_services_from_build' && ret=0
 27@@ -207,13 +204,16 @@ __docker-compose_subcommand() {
 28         (bundle)
 29             _arguments \
 30                 $opts_help \
 31+                '--push-images[Automatically push images for any services which have a `build` option specified.]' \
 32                 '(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
 33             ;;
 34         (config)
 35             _arguments \
 36                 $opts_help \
 37                 '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
 38-                '--services[Print the service names, one per line.]' && ret=0
 39+                '--resolve-image-digests[Pin image tags to digests.]' \
 40+                '--services[Print the service names, one per line.]' \
 41+                '--volumes[Print the volume names, one per line.]' && ret=0
 42             ;;
 43         (create)
 44             _arguments \
 45@@ -242,7 +242,7 @@ __docker-compose_subcommand() {
 46                 $opts_help \
 47                 '-d[Detached mode: Run command in the background.]' \
 48                 '--privileged[Give extended privileges to the process.]' \
 49-                '--user=[Run the command as this user.]:username:_users' \
 50+		'(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
 51                 '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
 52                 '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
 53                 '(-):running services:__docker-compose_runningservices' \
 54@@ -252,6 +252,12 @@ __docker-compose_subcommand() {
 55         (help)
 56             _arguments ':subcommand:__docker-compose_commands' && ret=0
 57             ;;
 58+	(images)
 59+	    _arguments \
 60+		$opts_help \
 61+		'-q[Only display IDs]' \
 62+		'*:services:__docker-compose_services_all' && ret=0
 63+	    ;;
 64         (kill)
 65             _arguments \
 66                 $opts_help \
 67@@ -308,16 +314,17 @@ __docker-compose_subcommand() {
 68         (run)
 69             _arguments \
 70                 $opts_help \
 71+                $opts_no_deps \
 72                 '-d[Detached mode: Run container in the background, print new container name.]' \
 73                 '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
 74                 '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
 75                 '--name=[Assign a name to the container]:name: ' \
 76-                $opts_no_deps \
 77                 '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
 78                 '--rm[Remove container after run. Ignored in detached mode.]' \
 79                 "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
 80                 '-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \
 81                 '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
 82+                '(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \
 83                 '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
 84                 '(-):services:__docker-compose_services' \
 85                 '(-):command: _command_names -e' \
 86@@ -340,6 +347,11 @@ __docker-compose_subcommand() {
 87                 $opts_timeout \
 88                 '*:running services:__docker-compose_runningservices' && ret=0
 89             ;;
 90+        (top)
 91+            _arguments \
 92+                $opts_help \
 93+                '*:running services:__docker-compose_runningservices' && ret=0
 94+            ;;
 95         (unpause)
 96             _arguments \
 97                 $opts_help \
 98@@ -385,9 +397,17 @@ _docker-compose() {
 99     integer ret=1
100     typeset -A opt_args
101 
102+    local file_description
103+
104+    if [[ -n ${words[(r)-f]} || -n ${words[(r)--file]} ]] ; then