From 60fe97416c9e4f8b1ad3481092b1308cff5c1ed0 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 5 Jun 2023 16:46:06 +0200 Subject: [PATCH] don't skip `compose` used as project name Signed-off-by: Nicolas De Loof --- cmd/compatibility/convert.go | 4 ---- cmd/compatibility/convert_test.go | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/compatibility/convert.go b/cmd/compatibility/convert.go index fb6e9a83df..831a6ecb9d 100644 --- a/cmd/compatibility/convert.go +++ b/cmd/compatibility/convert.go @@ -62,10 +62,6 @@ func Convert(args []string) []string { continue } if len(arg) > 0 && arg[0] != '-' { - // not a top-level flag anymore, keep the rest of the command unmodified - if arg == compose.PluginName { - i++ - } command = append(command, args[i:]...) break } diff --git a/cmd/compatibility/convert_test.go b/cmd/compatibility/convert_test.go index ae2423624e..b0bb71f575 100644 --- a/cmd/compatibility/convert_test.go +++ b/cmd/compatibility/convert_test.go @@ -83,6 +83,11 @@ func Test_convert(t *testing.T) { args: []string{"--project-directory", "", "ps"}, want: []string{"compose", "--project-directory", "", "ps"}, }, + { + name: "compose as project name", + args: []string{"--project-name", "compose", "down", "--remove-orphans"}, + want: []string{"compose", "--project-name", "compose", "down", "--remove-orphans"}, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {