Skip to content

Conversation

@MasonM
Copy link
Member

@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 <651224+MasonM@users.noreply.github.com>
@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.

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