summaryrefslogtreecommitdiff
path: root/plugins/docker-compose
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/docker-compose')
-rw-r--r--plugins/docker-compose/README.md2
-rw-r--r--plugins/docker-compose/_docker-compose2
-rw-r--r--plugins/docker-compose/docker-compose.plugin.zsh7
3 files changed, 8 insertions, 3 deletions
diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md
index 66d4e0521..5a0290462 100644
--- a/plugins/docker-compose/README.md
+++ b/plugins/docker-compose/README.md
@@ -2,6 +2,8 @@
This plugin provides completion for [docker-compose](https://docs.docker.com/compose/) as well as some
aliases for frequent docker-compose commands.
+This plugin chooses automatically between the legacy `docker-compose` command and the modern
+`docker compose` subcommand, preferring `docker-compose` when both are available.
To use it, add docker-compose to the plugins array of your zshrc file:
diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose
index c6b733500..d0ebfe515 100644
--- a/plugins/docker-compose/_docker-compose
+++ b/plugins/docker-compose/_docker-compose
@@ -128,7 +128,7 @@ __docker-compose_subcommand() {
'--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
'--volumes[Print the volume names, one per line.]' \
- '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
+ '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
;;
(create)
_arguments \
diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh
index d1823f535..7863c4f39 100644
--- a/plugins/docker-compose/docker-compose.plugin.zsh
+++ b/plugins/docker-compose/docker-compose.plugin.zsh
@@ -1,5 +1,8 @@
-# support Compose v2 as docker CLI plugin
-(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose'
+# Support Compose v2 as docker CLI plugin
+#
+# This tests that the (old) docker-compose command is in $PATH and that
+# it resolves to an existing executable file if it's a symlink.
+[[ -x "${commands[docker-compose]:A}" ]] && dccmd='docker-compose' || dccmd='docker compose'
alias dco="$dccmd"
alias dcb="$dccmd build"