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

Do not print help when the start command encounters an error #670

Closed
4 tasks
dwedul-figure opened this issue Feb 17, 2022 · 0 comments · Fixed by #671
Closed
4 tasks

Do not print help when the start command encounters an error #670

dwedul-figure opened this issue Feb 17, 2022 · 0 comments · Fixed by #671
Labels
CLI Command line interface feature enhancement New feature or request good first issue Good for newcomers

Comments

@dwedul-figure
Copy link
Contributor

dwedul-figure commented Feb 17, 2022

Summary

Do not print the start command's usage/help when an error is encountered.

Problem Definition

Currently, if an error is encountered while a node is running (or trying to start), the error is printed, then the usage info for the provenanced start command is printed. That usage info is quite verbose (there are lots of flags), and it often pushes the error off of the screen. Additionally, the usage information is rarely useful in that situation since the error usually isn't related to the command used to invoke it, but related to something else with the chain, system or configuration.

Proposal

Add this to the end of func initRootCmd:

	// Disable help when the start command returns an error.
	startCmd, _, err := rootCmd.Find([]string{"start"})
	if err != nil {
		panic(fmt.Errorf("start command not found: %w", err))
	}
	startCmd.SilenceUsage = true

Doing this will still allow provenanced start --help and provenance help start to work as expected. But when you do provenanced start and end up getting an error, it won't print usage info any more.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Command line interface feature enhancement New feature or request good first issue Good for newcomers
Projects
Development

Successfully merging a pull request may close this issue.

1 participant