diff --git a/cmd/compatibility/convert.go b/cmd/compatibility/convert.go index d6d883405..9bef94bf5 100644 --- a/cmd/compatibility/convert.go +++ b/cmd/compatibility/convert.go @@ -58,17 +58,18 @@ func Convert(args []string) []string { command = append(command, args[i:]...) break } - if arg == "--verbose" { + + switch arg { + case "--verbose": arg = "--debug" - } - if arg == "-h" { + case "-h": // docker cli has deprecated -h to avoid ambiguity with -H, while docker-compose still support it arg = "--help" - } - if arg == "--version" || arg == "-v" { + case "--version", "-v": // redirect --version pseudo-command to actual command arg = "version" } + if contains(getBoolFlags(), arg) { rootFlags = append(rootFlags, arg) continue diff --git a/cmd/compatibility/convert_test.go b/cmd/compatibility/convert_test.go index e53cbb157..ae2423624 100644 --- a/cmd/compatibility/convert_test.go +++ b/cmd/compatibility/convert_test.go @@ -43,11 +43,21 @@ func Test_convert(t *testing.T) { args: []string{"--host", "tcp://1.2.3.4", "up"}, want: []string{"--host", "tcp://1.2.3.4", "compose", "up"}, }, + { + name: "compose --verbose", + args: []string{"--verbose"}, + want: []string{"--debug", "compose"}, + }, { name: "compose --version", args: []string{"--version"}, want: []string{"compose", "version"}, }, + { + name: "compose -v", + args: []string{"-v"}, + want: []string{"compose", "version"}, + }, { name: "help", args: []string{"-h"},