spf13 / cobra

A Commander for modern Go CLI interactions
https://cobra.dev
Apache License 2.0
37.8k stars 2.83k forks source link

Allow `SilenceErrors` or `SilenceUsage` to override the rootCmd value. #2145

Open trajano opened 4 months ago

trajano commented 4 months ago

I am trying to write something that augments the docker-cli so if it fails the parsing I would normally let it run the existing docker command. What I wanted to do though is add a new command that I know would not be in docker e.g. docker bash I would like to be able to make Cobra just show the usage or errors by setting SilenceErrors and SilenceUsage to true on the specific command