Add support for multiple flag values via repeated flags using ellipsis syntax#6198
Open
Add support for multiple flag values via repeated flags using ellipsis syntax#6198
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for multiple statuses in wp theme list command
Add support for multiple flag values via repeated flags
Jan 19, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for specifying multiple values for a flag by repeating it (e.g., --status=active --status=parent), addressing the inability to filter by multiple status values in commands like wp theme list.
Changes:
- Modified argument parsing to collect repeated flags into arrays instead of overwriting values
- Added
multiple: trueannotation support in PHPdoc YAML for parameters that should accept multiple values - Implemented backward compatibility by using the last value when
multipleis not set or is false
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| php/WP_CLI/Configurator.php | Collects repeated flag values into arrays during argument parsing |
| php/WP_CLI/Dispatcher/Subcommand.php | Validates multiple flag values and preserves arrays when multiple: true is set |
| tests/ConfiguratorTest.php | Unit test verifying multiple flag values are parsed correctly |
| features/multiple-flag-values.feature | Feature tests for multiple values, backward compatibility, and validation |
| MULTIPLE_FLAG_VALUES_IMPLEMENTATION.md | Documentation of implementation details and usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…end() Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 task
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Replace the `multiple: true` annotation approach with the existing ellipsis syntax (e.g., `[--status=<status>...]`) which is already used for repeating positional parameters. This leverages the existing `$spec['repeating']` attribute from SynopsisParser rather than introducing a new annotation. Changes: - Updated Subcommand.php to check $spec['repeating'] instead of $spec_args['multiple'] - Updated feature tests to use [--status=<status>...] syntax - Updated documentation to reflect the ellipsis approach Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Copilot
AI
changed the title
Add support for multiple flag values via repeated flags
Add support for multiple flag values via repeated flags using ellipsis syntax
Feb 6, 2026
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.
Implementation Complete: Multiple Flag Values Support ✅
This PR implements support for passing the same flag multiple times to provide multiple values, addressing issue #159. Users can now use
--status=active --status=parentinstead of being limited to comma-separated values.Core Changes
Configurator::unmix_assoc_args()to collect multiple flag values into arraysSubcommand::validate_args()to handle repeating parameters using ellipsis syntax...) consistent with repeating positional parametersTesting & Quality
Usage Example
How to Add to Your Command
Use the ellipsis syntax in the synopsis (same as for repeating positional parameters):
This leverages the existing
$spec['repeating']attribute fromSynopsisParser, which already detects the ellipsis and works with infrastructure likeprompt_args().Follow-up Required
The changes in vendor files (Theme_Command.php, Plugin_Command.php, CommandWithUpgrade.php) need to be submitted to the
wp-cli/extension-commandrepository separately. SeeMULTIPLE_FLAG_VALUES_IMPLEMENTATION.mdfor details.Files Changed
php/WP_CLI/Configurator.php- Argument parsing with modern array destructuringphp/WP_CLI/Dispatcher/Subcommand.php- Validation logic using $spec['repeating']tests/ConfiguratorTest.php- Unit testsfeatures/multiple-flag-values.feature- Feature tests with ellipsis syntaxMULTIPLE_FLAG_VALUES_IMPLEMENTATION.md- DocumentationOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.