-
Notifications
You must be signed in to change notification settings - Fork 35
Fix Shipwright CLI output message when incorrect flag is passed #347
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 Shipwright CLI output message when incorrect flag is passed #347
Conversation
Fixes shipwright-io#346 # Changes: - Discard any messages or error written to stdio or stderr by goflag library. Return the error only. - In case of error while parsing the goflags, print the error, then print the CLI help and then exit with 1. Signed-off-by: Sayan Biswas <[email protected]>
1f65bed
to
9427167
Compare
/cc @adambkaplan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected.
Test output:
➜ shp-cli git:(fix-help-version) ./shp --version
ERROR: flag provided but not defined: -version
Command-line client for Shipwright's Build API.
Usage:
shp [command] [resource] [flags]
shp [command]
Available Commands:
build Manage Builds
buildrun Manage BuildRuns
buildstrategy Manage namespaced BuildStrategies
clusterbuildstrategy Manage cluster-scoped BuildStrategies
version version
Flags:
--kubeconfig string Path to the kubeconfig file to use for CLI requests.
-n, --namespace string If present, the namespace scope for this CLI request
--request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
Use "shp [command] --help" for more information about a command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
While normally I wouldn't merge this for the sake of release stability, this is a highly visible bug fix that carries low risk.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adambkaplan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Changes
Fixes #346
Submitter Checklist
See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.
Release Notes