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

feat(command): show global options in command help #1949

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

BlackHole1
Copy link
Contributor

@BlackHole1 BlackHole1 commented Jul 9, 2024

If there are persistent flags, they should also be displayed in the command.

What type of PR is this?

  • feature

What this PR does / why we need it:

If there is a persistent flag named foo and Required: true, the user will not see this flag when executing cmd subCommand --help, but an error will be reported if the user does not provide this flag. This will cause confusion for the user.

Which issue(s) this PR fixes:

Close #734

Special notes for your reviewer:

Does the VisiblePersistentFlags function need to handle the case of MutuallyExclusiveFlags internally?

Testing

go test -run=TestShowSubcommandHelp_GlobalOptions 

Release Notes

Subcommands support displaying global options.

/cc @dearchap

@BlackHole1 BlackHole1 requested a review from a team as a code owner July 9, 2024 08:30
If there are persistent flags, they should also be displayed in the command.

Signed-off-by: Kevin Cui <[email protected]>
command.go Show resolved Hide resolved
godoc-current.txt Show resolved Hide resolved
Copy link
Member

@Juneezee Juneezee left a comment

Choose a reason for hiding this comment

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

LGTM 👍 . Thanks for your contribution!

Copy link

@decentral1se decentral1se left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

@BlackHole1
Copy link
Contributor Author

Friendly ping :)

@abennett abennett merged commit 937cfe9 into urfave:main Jul 11, 2024
13 checks passed
@abennett
Copy link
Contributor

Thanks again!

@BlackHole1 BlackHole1 deleted the add-global-options branch July 11, 2024 03:10
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.

Display global flags in subcommand
4 participants