cobra
cobra copied to clipboard
Output usage hint for both unknown subcommand and unknown flag in the same way
Now, when you try to run a Command with an unknown sub-command vs. an unknown flag, you'll get:
$ testcommand asdsa
Error: unknown command "asdsa" for "testcommand"
Run 'testcommand --help' for usage.
$ testcommand --asdsa
Error: unknown flag: --asdsa
$ testcommand -asdsa
Error: unknown shorthand flag: 'a' in -asdsa
With these changes, you'll get:
$ testcommand asdsa
Error: unknown command "asdsa" for "testcommand"
Run 'testcommand --help' for usage.
$ testcommand --asdsa
Error: unknown flag: --asdsa
Run 'testcommand --help' for usage.
$ testcommand -asdsa
Error: unknown shorthand flag: 'a' in -asdsa
Run 'testcommand --help' for usage.
This PR is being marked as stale due to a long period of inactivity
Bump!
@spf13 can you please merge this commit? We need it!