Skip to content

Improve argument alias parsing and --prompt support#6323

Merged
swissspidy merged 1 commit into
mainfrom
fix/arg-alias
May 27, 2026
Merged

Improve argument alias parsing and --prompt support#6323
swissspidy merged 1 commit into
mainfrom
fix/arg-alias

Conversation

@swissspidy
Copy link
Copy Markdown
Member

This is a follow-up to #6176

I noticed this bug in wp-cli/core-command#335

Copilot AI review requested due to automatic review settings May 27, 2026 13:33
@swissspidy swissspidy requested a review from a team as a code owner May 27, 2026 13:33
@github-actions github-actions Bot added bug command:cli Related to 'cli' command command:cli-alias Related to 'cli alias' command command:cli-utils labels May 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a follow-up to argument-alias support (#6176) that fixes alias parsing for assoc args when the =<value> spec is attached to an alias instead of the canonical name, and extends --prompt so it can target parameters via either their canonical name or any alias.

Changes:

  • Update SynopsisParser::classify_token() to extract assoc value specs before splitting out pipe-based aliases, so --canonical|alias=<value> is parsed correctly as an assoc parameter.
  • Extend Subcommand::prompt_args() matching so --prompt= can reference assoc parameters by alias name as well as canonical name.
  • Add feature scenarios covering prompting with aliases and bypassing prompts when an alias is supplied on the command line.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
php/WP_CLI/SynopsisParser.php Fixes parsing order so assoc value specs are recognized even when written on an alias segment.
php/WP_CLI/Dispatcher/Subcommand.php Allows --prompt to match assoc args via aliases, aligning prompting behavior with alias resolution.
features/arg-aliases.feature Adds coverage for --prompt + aliases, including value-spec-on-alias cases and prompt bypass.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@swissspidy swissspidy merged commit 04de361 into main May 27, 2026
78 checks passed
@swissspidy swissspidy added this to the 3.0.0 milestone May 27, 2026
@swissspidy swissspidy deleted the fix/arg-alias branch May 27, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:cli Related to 'cli' command command:cli-alias Related to 'cli alias' command command:cli-utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants