Skip to content

Commit

Permalink
[update] Doc to use errPrefix
Browse files Browse the repository at this point in the history
Description to change it and what it is.
  • Loading branch information
5ouma committed Aug 31, 2023
1 parent ff58b53 commit a76559e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions site/content/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,12 @@ Running an application with the '--version' flag will print the version to stdou
the version template. The template can be customized using the
`cmd.SetVersionTemplate(s string)` function.

## Error Message Prefix

Cobra prints an error message when being returned 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

It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order:
Expand Down

0 comments on commit a76559e

Please sign in to comment.