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

fix: don't print help for non-validation errors. Fixes #13826 #13831

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

MasonM
Copy link
Contributor

@MasonM MasonM commented Oct 29, 2024

Fixes #13826

Motivation

#13656 changed all CLI commands to use RunE instead of Run and to use Cobra validators for validating arguments. The default behavior with Cobra is to print the help text for all errors, which can be tedious to scroll through.

Modifications

This changes the CLI to only print the help text for argument validation errors, which should match the previous behavior.

Verification

$ ./dist/argo submit 'ANYexampleworkflow.yaml'
Error: open ANYexampleworkflow.yaml: no such file or directory

 $ ./dist/argo submit --from workflow/basic 'ANYexampleworkflow.yaml'
Error: cannot combine --from with file arguments
Usage:
  argo submit [FILE... | --from `kind/name] [flags]
<SNIP>

argoproj#13656 changed all CLI
commands to use `RunE` instead of `Run` and [cobra
validators](https://cobra.dev/#positional-and-custom-arguments). The
default behavior with Cobra is to print the help text for all errors,
which can be tedious to scroll through.

This changes the CLI to only print the help text for argument validation
errors, which should match the previous behavior.

Signed-off-by: Mason Malone <[email protected]>
@MasonM MasonM marked this pull request as ready for review October 29, 2024 04:32
Copy link
Member

@Joibel Joibel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works for me locally, thanks for fixing this quickly.

@Joibel Joibel merged commit 39154fd into argoproj:main Oct 29, 2024
28 checks passed
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

Successfully merging this pull request may close these issues.

3.6.0-rc3 CLI: Do not print help output on submission error
2 participants