You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see what you're saying, and it is an issue, but the solution complicates the parsing logic considerably. Currently, the parser is effectively a state machine. Each argument is parsed, and the state changes. When a command is encountered, the flags for that command are added to the set of flags that are eligible for evaluation, and parsing continues.
To fix this issue, the parser would need to look forward in the command line to see if a command is provided, then, if not, rewind and parse the flags as if the default command were provided.
I'm somewhat inclined to simply remove support for default commands in v3, as it has been an unexpected source of complexity.
Command
Output
Command
Output
Expected behavior
go run app.go --verbose
andgo run app.go old --verbose
should both display the same usage without any error asold
is a default command.The text was updated successfully, but these errors were encountered: