-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🌱 pkg/cli: fix lack of help when --help is set #1900
Conversation
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12, estroz 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 |
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.
@estroz I thought that I was able to find a way to print the help message without this special case. Could you elaborate on the behavior that you consider broken?
(I know it is merged already)
// User needs *generic* help if args are incorrect or --help is set and | ||
// --project-version is not set. Plugin-specific help is given if a | ||
// plugin.Context is updated, which does not require this field. | ||
c.doHelp = err != nil || help && !fs.Lookup(projectVersionFlag).Changed |
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.
err == nil
always due to how flags are parsed ( plfag.ExitOnError
and pflag.ParseErrorsWhitelist{UnknownFlags: true}
).
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.
While true, code should handle every error where possible in case library behavior changes.
I think the problem was that somehow flag parsing was ending in |
It says |
#1828 removed
--help
handling so thatkubebuilder -h
will only print/kind bug