-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error handling in /commands #1502
Comments
bep
added a commit
to bep/hugo
that referenced
this issue
Dec 2, 2015
Cobra, the CLI commander in use in Hugo, has some long awaited improvements in the error handling department. This enables a more centralized error handling approach. This commit introduces that by changing all the command funcs to `RunE`: * The core part of the error logging, usage logging and `os.Exit(-1)` is now performed in one place and that one place only. * The usage text is now only shown on invalid arguments etc. (user errors) Fixes gohugoio#1502
bep
added a commit
that referenced
this issue
Dec 2, 2015
anthonyfok
added a commit
that referenced
this issue
Dec 2, 2015
And some other small code clean-up. See #1502
bep
added a commit
that referenced
this issue
Dec 2, 2015
bramp
pushed a commit
to bramp/hugo
that referenced
this issue
Dec 17, 2015
Cobra, the CLI commander in use in Hugo, has some long awaited improvements in the error handling department. This enables a more centralized error handling approach. This commit introduces that by changing all the command funcs to `RunE`: * The core part of the error logging, usage logging and `os.Exit(-1)` is now performed in one place and that one place only. * The usage text is now only shown on invalid arguments etc. (user errors) Fixes gohugoio#1502
bramp
pushed a commit
to bramp/hugo
that referenced
this issue
Dec 17, 2015
bramp
pushed a commit
to bramp/hugo
that referenced
this issue
Dec 17, 2015
And some other small code clean-up. See gohugoio#1502
bramp
pushed a commit
to bramp/hugo
that referenced
this issue
Dec 17, 2015
tychoish
pushed a commit
to tychoish/hugo
that referenced
this issue
Aug 13, 2017
Cobra, the CLI commander in use in Hugo, has some long awaited improvements in the error handling department. This enables a more centralized error handling approach. This commit introduces that by changing all the command funcs to `RunE`: * The core part of the error logging, usage logging and `os.Exit(-1)` is now performed in one place and that one place only. * The usage text is now only shown on invalid arguments etc. (user errors) Fixes gohugoio#1502
tychoish
pushed a commit
to tychoish/hugo
that referenced
this issue
Aug 13, 2017
tychoish
pushed a commit
to tychoish/hugo
that referenced
this issue
Aug 13, 2017
And some other small code clean-up. See gohugoio#1502
tychoish
pushed a commit
to tychoish/hugo
that referenced
this issue
Aug 13, 2017
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
See 9d603ce
The commands package is full of these constructions.
Cobra now has a
RunE
func that can be used to a better job with these:https://github.com/spf13/cobra/blob/master/command.go#L82
The text was updated successfully, but these errors were encountered: