Skip to content
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

Prefer RunE over Run for Cobra commands #57

Open
jnschaeffer opened this issue Mar 29, 2023 · 0 comments
Open

Prefer RunE over Run for Cobra commands #57

jnschaeffer opened this issue Mar 29, 2023 · 0 comments

Comments

@jnschaeffer
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Cobra Command structs can use either the Run or RunE fields to run actual commands. Using RunE for commands rather than Run allows us to return errors when commands fail, which can be nicer to work with than using logger.Fatal.

Describe the solution you'd like
All commands that are populated with Run set are populated with RunE set instead.

Describe alternatives you've considered
We can leave things as they are, but it makes commands harder to read and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant