[update] Several changes that were reviewed

Fix some grammar misses and use `cmd` for subcommands.
This commit is contained in:
5ouma 2023-09-08 11:32:04 +09:00
parent da3c9eeebd
commit fabc43c5eb
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -1099,7 +1099,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
// If root command has SilenceErrors flagged,
// all subcommands should respect it
if !cmd.SilenceErrors && !c.SilenceErrors {
c.PrintErrln(c.ErrPrefix(), err.Error())
c.PrintErrln(cmd.ErrPrefix(), err.Error())
}
// If root command has SilenceUsage flagged,

View file

@ -598,8 +598,8 @@ the version template. The template can be customized using the
## Error Message Prefix
Cobra prints an error message when being returned a non-nil error value.
The default error message is `Error: error contents`.
Cobra prints an error message when receiving a non-nil error value.
The default error message is `Error: <error contents>`.
The Prefix, `Error:` can be customized using the `cmd.SetErrPrefix(s string)` function.
## PreRun and PostRun Hooks