From c396efbee3217f1d5cc433cd788a67f747a579cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 11:26:39 +0200 Subject: [PATCH] fix(docker-compose): support Compose V2 `docker compose` command (#10248) --- .../docker-compose/docker-compose.plugin.zsh | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 85e03d343..2eba20a09 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -1,28 +1,22 @@ -# Authors: -# https://github.com/tristola -# -# Docker-compose related zsh aliases +# support Compose v2 as docker CLI plugin +command docker compose &>/dev/null && dccmd='docker compose' || dccmd='docker-compose' -# Aliases ################################################################### +alias dco="$dccmd" +alias dcb="$dccmd build" +alias dce="$dccmd exec" +alias dcps="$dccmd ps" +alias dcrestart="$dccmd restart" +alias dcrm="$dccmd rm" +alias dcr="$dccmd run" +alias dcstop="$dccmd stop" +alias dcup="$dccmd up" +alias dcupb="$dccmd up --build" +alias dcupd="$dccmd up -d" +alias dcdn="$dccmd down" +alias dcl="$dccmd logs" +alias dclf="$dccmd logs -f" +alias dcpull="$dccmd pull" +alias dcstart="$dccmd start" +alias dck="$dccmd kill" -# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator' -# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html - -alias dco='docker-compose' - -alias dcb='docker-compose build' -alias dce='docker-compose exec' -alias dcps='docker-compose ps' -alias dcrestart='docker-compose restart' -alias dcrm='docker-compose rm' -alias dcr='docker-compose run' -alias dcstop='docker-compose stop' -alias dcup='docker-compose up' -alias dcupb='docker-compose up --build' -alias dcupd='docker-compose up -d' -alias dcdn='docker-compose down' -alias dcl='docker-compose logs' -alias dclf='docker-compose logs -f' -alias dcpull='docker-compose pull' -alias dcstart='docker-compose start' -alias dck='docker-compose kill' +unset dccmd