From fabc43c5eb01771416e69f31ff874e59d8594fa6 Mon Sep 17 00:00:00 2001 From: 5ouma <101255979+5ouma@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:32:04 +0900 Subject: [PATCH] [update] Several changes that were reviewed Fix some grammar misses and use `cmd` for subcommands. --- command.go | 2 +- site/content/user_guide.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/command.go b/command.go index 7f036307..6866f7d0 100644 --- a/command.go +++ b/command.go @@ -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, diff --git a/site/content/user_guide.md b/site/content/user_guide.md index 03972bb9..93daadf5 100644 --- a/site/content/user_guide.md +++ b/site/content/user_guide.md @@ -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: `. The Prefix, `Error:` can be customized using the `cmd.SetErrPrefix(s string)` function. ## PreRun and PostRun Hooks