Improve argument alias parsing and --prompt support#6323
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #6176
I noticed this bug in wp-cli/core-command#335