Warn when commands override global arguments #6174
Open
+162
−0
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.
Custom commands can define arguments with the same names as WP-CLI's global arguments (
--debug,--user,--quiet, etc.), causing flags to silently fail or behave unexpectedly. This makes it difficult to introduce new global arguments without breaking existing commands.Changes
Added
check_global_arg_conflicts()validation inWP_CLI::add_command()Added Behat test scenarios covering single conflicts, multiple conflicts, and no false positives
Example
Commands registering conflicting arguments now emit warnings at registration time:
Warnings are informational only—commands continue to work. The
--quietflag suppresses warnings as expected.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php d asp_tags=Off' '-d short_open_tag=Off' '-d error_reporting=E_ALL' '-n' '-l' './bundle/rmccue/resh(dns block)/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php tup_errors=0' '-d asp_tags=Off' -v(dns block)nosuchhost_asdf_asdf_asdf.com/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php d asp_tags=Off' '-d short_open_tag=Off' '-d error_reporting=E_ALL' '-n' '-l' './bundle/rmccue/resh(dns block)/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php tup_errors=0' '-d asp_tags=Off' -v(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.