Skip to content

Commit 0ac86de

Browse files
committed
Fix commandPathFromArgs to skip flags instead of breaking
The function now continues past flags and their values rather than breaking on the first flag, allowing it to correctly extract command paths like 'query list' from invocations such as 'dune --api-key KEY query list'.
1 parent d21cbba commit 0ac86de

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cli/root.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,18 @@ func Execute(version, commit, date, amplitudeKey string) {
145145
// rather than "query list --limit 10".
146146
func commandPathFromArgs(args []string) string {
147147
var parts []string
148+
skipNext := false
148149
for _, a := range args[1:] { // skip binary name
150+
if skipNext {
151+
skipNext = false
152+
continue
153+
}
149154
if strings.HasPrefix(a, "-") {
150-
break
155+
// Skip flag; if it doesn't contain '=', also skip next token (the value)
156+
if !strings.Contains(a, "=") {
157+
skipNext = true
158+
}
159+
continue
151160
}
152161
parts = append(parts, a)
153162
}

0 commit comments

Comments
 (0)