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

✨ Build the command and use it to report user errors #1937

Merged
merged 1 commit into from
Jan 18, 2021

Conversation

Adirio
Copy link
Contributor

@Adirio Adirio commented Jan 12, 2021

Improve error reporting by printing the command usage
Fixes: #1913
Fixes: #1914
Fixes: #1915

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 12, 2021
@Adirio Adirio force-pushed the enhance-root-cmd branch 6 times, most recently from 397fd5d to c27b017 Compare January 12, 2021 14:36
@Adirio
Copy link
Contributor Author

Adirio commented Jan 12, 2021

@estroz I removed the doHelp field again that you restored in #1900 but I think this PR behavior is correct now. Basically the "base" flagset was printing its usage message in case we had the --help or -h flags as that is hardcoded before the whitelist filter, so by adding a dummy --help and -h flag to this base FlagSet we prevent this behavior and we delegate into the cobra command to print its usage.

…d help message is printed

Signed-off-by: Adrian Orive <adrian.orive.oneca@gmail.com>
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/approve

Great work. it shows terrific for me 👍

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Adirio, camilamacedo86

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2021
@estroz
Copy link
Contributor

estroz commented Jan 18, 2021

@Adirio this behavior does look a lot better.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 18, 2021
@k8s-ci-robot k8s-ci-robot merged commit c577244 into kubernetes-sigs:master Jan 18, 2021
@Adirio Adirio deleted the enhance-root-cmd branch January 18, 2021 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
4 participants