Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(console): support negative arguments #660

Merged

Conversation

innocenzi
Copy link
Member

This pull request adds support for converting boolean flags that start with --no to their non-negative version.

For instance, the flag --no-interaction will be parsed as $interaction = false. This is a common practice in JavaScript and Rust CLIs, and a practical feature, both user and developer wise, to handle boolean flags in multiple ways, whichever feels more natural.

Non-boolean flags will be handled as before, keeping the no- prefix.

Here are a few examples:

Flag Name Value
--no-interaction interaction false
--noInteraction interaction false
--interaction interaction true
--interaction=false interaction false
--interaction=true interaction true
--no-interaction=true interaction false
--no-interaction=false interaction true

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11638992262

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 82.308%

Totals Coverage Status
Change from base Build 11622363967: 0.02%
Covered Lines: 7011
Relevant Lines: 8518

💛 - Coveralls

@brendt
Copy link
Member

brendt commented Nov 2, 2024

Huh, very nice!

@brendt brendt merged commit 1cdf158 into tempestphp:main Nov 2, 2024
57 checks passed
@innocenzi innocenzi deleted the feat/console/support-negative-arguments branch November 4, 2024 00:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants