mitchellh / cli

A Go library for implementing command-line interfaces.
Mozilla Public License 2.0
1.73k stars 123 forks source link

Fix bug in which "fooasdf -o=foo" is incorrectly identified as the subcommand "foo" #93

Closed kmoe closed 2 years ago

kmoe commented 2 years ago

Fixes #92

There are a number of ways to fix this. Another approach would be to modify the regex used on line 704 to explicitly exclude cases in which the string ending in the subcommand is itself a flag.

mitchellh commented 2 years ago

Looks great. Very amusing no one has ever noticed this before. :) Thank you! I think this approach is totally fine (and maybe the best), as long as we have a test and there is no user-facing API change we can always improve the implementation if we find a better approach.