Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OnUsageErrorFunc now handles mutually exclusive flag errors#2147

Closed
ayoisaiah wants to merge 1 commit intourfave:mainfrom
ayoisaiah:mutuallyexlusiveflag_error_handling
Closed

OnUsageErrorFunc now handles mutually exclusive flag errors#2147
ayoisaiah wants to merge 1 commit intourfave:mainfrom
ayoisaiah:mutuallyexlusiveflag_error_handling

Conversation

@ayoisaiah
Copy link

What type of PR is this?

  • bug

What this PR does / why we need it:

The PR allows the OnUsageErrorFunc to also handle errors reported by MutuallyExclusiveFlags

Which issue(s) this PR fixes:

Fixes #2146

Release Notes

NONE

@ayoisaiah ayoisaiah requested a review from a team as a code owner May 24, 2025 15:38
if err := grp.check(cmd); err != nil {
_ = ShowSubcommandHelp(cmd)
if cmd.OnUsageError != nil {
err = cmd.OnUsageError(ctx, cmd, err, cmd.parent != nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

@ayoisaiah Can you add a test case to cover this ?

Copy link
Contributor

Choose a reason for hiding this comment

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

✋ I will cover it with tests and make another PR

@dearchap dearchap closed this Jun 6, 2025
@dearchap
Copy link
Contributor

dearchap commented Jun 6, 2025

Fixed by #2152

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.

OnUsageError function doesn't trigger for errors caused by mutually exclusive flags

3 participants

Comments