From e21e5f0b09663cc7b9c45e02b56b8f8c75591e38 Mon Sep 17 00:00:00 2001 From: Austin Riendeau Date: Thu, 18 Feb 2016 13:57:07 -0700 Subject: [PATCH] updates readme to Explain SilenceErrors and SilenceUsage #225 --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 750775f1..f326c7fa 100644 --- a/README.md +++ b/README.md @@ -713,7 +713,8 @@ func main() { ## Alternative Error Handling -Cobra also has functions where the return signature is an error. This allows for errors to bubble up to the top, providing a way to handle the errors in one location. The current list of functions that return an error is: +Cobra also has functions where the return signature is an error. This allows for errors to bubble up to the top, +providing a way to handle the errors in one location. The current list of functions that return an error is: * PersistentPreRunE * PreRunE @@ -721,6 +722,10 @@ Cobra also has functions where the return signature is an error. This allows for * PostRunE * PersistentPostRunE +If you would like to silence the default `error` and `usage` output in favor of your own, you can set `SilenceUsage` +and `SilenceErrors` to `false` on the command. A child command respects these flags if they are set on the parent +command. + **Example Usage using RunE:** ```go