argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
15.11k stars 3.21k forks source link

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

Closed MasonM closed 3 weeks ago

MasonM commented 3 weeks ago

Fixes #13826

Motivation

https://github.com/argoproj/argo-workflows/pull/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>