Skip to content

feat(console): support negative arguments#660

Merged
brendt merged 1 commit intotempestphp:mainfrom
innocenzi:feat/console/support-negative-arguments
Nov 2, 2024
Merged

feat(console): support negative arguments#660
brendt merged 1 commit intotempestphp:mainfrom
innocenzi:feat/console/support-negative-arguments

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
@innocenzi innocenzi deleted the feat/console/support-negative-arguments branch November 4, 2024 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants