Repository navigation
Add support for multiple flag values via repeated flags using ellipsis syntax - #6198
Merged
Merged
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! |
…end() Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
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.
Use "Filters: " consistently for both array and single value cases to improve test output readability and clarity. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Boolean flags (--flag or --no-flag) now use last-wins behavior when repeated, preventing issues with downstream code that expects scalar boolean values. Only non-boolean flags (--param=value) are aggregated into arrays when repeated. Added comprehensive tests: - Unit test for boolean flag last-wins behavior - Feature test scenario with multiple boolean flag combinations Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
swissspidy
approved these changes
Mar 5, 2026
Copilot AI
added a commit
to wp-cli/media-command
that referenced
this pull request
Mar 10, 2026
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
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 wp-cli/extension-command#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().Important Notes
--flagor--no-flag) use last-wins behavior - they are NOT aggregated into arrays--param=value) ARE aggregated into arrays when marked with ellipsis syntaxFollow-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 boolean flag handlingphp/WP_CLI/Dispatcher/Subcommand.php- Validation logic using $spec['repeating']tests/ConfiguratorTest.php- Unit tests including boolean flag testsfeatures/multiple-flag-values.feature- Feature tests with boolean flag scenarioMULTIPLE_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.