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

Silence help text on run errors #413

Open
bgins opened this issue Oct 23, 2024 · 1 comment
Open

Silence help text on run errors #413

bgins opened this issue Oct 23, 2024 · 1 comment

Comments

@bgins
Copy link
Contributor

bgins commented Oct 23, 2024

We currently print the help text on every command failure. Printing usage information is great when an error occurs parsing CLI options. However, it's noisy and unhelpful for errors reported afterwards.

Let's silence the help text after we have parsed CLI options. For example, in the run subcommand:

options, err := optionsfactory.ProcessJobCreatorOptions(options, args, network)
if err != nil {
return err
}
return runJob(cmd, options, network)

we could set cmd.SilenceUsage to true after handling any ProcessJobCreatorOptions errors.

The silenced error output can be tested by temporarily returning an error from the first line of the runJob function:

func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network string) error {
c := color.New(color.FgCyan).Add(color.Bold)

@gurkin2005
Copy link

I would like to work on this

@bgins bgins assigned bgins and gurkin2005 and unassigned bgins and gurkin2005 Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants