From a68e9ed30f508c4b990b37ae509b1c92a9db60bb Mon Sep 17 00:00:00 2001 From: Sunggun Yu Date: Tue, 15 Feb 2022 14:21:57 -0500 Subject: [PATCH] fix(root cmd): only args after double dash is command --- cmd/root.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 5a103cb..8f96248 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -82,9 +82,10 @@ func rootCommand() *cobra.Command { case cmd.ArgsLenAtDash() == 0: profile, err = Config.DefaultProfile() command = args - case cmd.ArgsLenAtDash() == 1: + case cmd.ArgsLenAtDash() > 0: profile, err = Config.Profiles.FindProfile(args[0]) - command = args[1:] + // only args after double dash "--"" should be considered as command + command = args[cmd.ArgsLenAtDash():] } if err != nil { checkErrorAndPrintCommandExample(cmd, err)