Skip to content

Fix: check MutuallyExclusiveFlags across parent command chain#2274

Open
siutsin wants to merge 1 commit intourfave:mainfrom
siutsin:fix-MutuallyExclusiveFlags
Open

Fix: check MutuallyExclusiveFlags across parent command chain#2274
siutsin wants to merge 1 commit intourfave:mainfrom
siutsin:fix-MutuallyExclusiveFlags

Conversation

@siutsin
Copy link
Contributor

@siutsin siutsin commented Mar 4, 2026

What type of PR is this?

  • bug

What this PR does / why we need it:

Follow-up to PR #2266. That PR fixed persistent flag propagation for MutuallyExclusiveFlags, but the exclusivity validation itself was not updated. The check only looked at the current command's groups, so parent group violations were silently ignored on subcommands.

This PR walks the parent chain when validating, matching how persistent flag inheritance already works in parseFlags.

Which issue(s) this PR fixes:

Fixes #2273

Testing

Added tests covering propagation, violation detection on subcommands and grandchild commands, and mixed parent/subcommand exclusive groups.

Release Notes

Fix `MutuallyExclusiveFlags` validation not being enforced on subcommands for persistent flags inherited from parent commands.

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.

MutuallyExclusiveFlags not validated on subcommands for persistent flags

1 participant