fix(cli): allow command flags to override globals#2295
Conversation
🦋 Changeset detectedLatest commit: 03f54cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec032f6ad8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33136cd23f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d2a705f12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bundle Size Analysis
|
Type
Description
Updates CLI global flag extraction so command-local flags take precedence when the selected command defines a flag with the same name or alias as a global flag.
Previously, global flags were consumed before command parsing, so a command-local flag such as
--version <value>could be intercepted by the built-in global--versionaction. The same issue applied to aliases, for example a global--output/-osetting consuming-o csvbefore a selected command's local-oflag could parse it.This change makes global flag consumption walk the command tree first. At each selected command level, local flags are preserved for command parsing before matching global flags. Global flags still work across the command tree, while command-local overrides on the active command path are now respected.
Adds regression tests for:
--version <value>overriding the built-in global--version-ooverriding a global--output/-o