Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow short options. Needed to pass along -vvv #76

Merged
merged 4 commits into from
Apr 1, 2024

Conversation

weitzman
Copy link
Member

@weitzman weitzman commented Mar 30, 2024

--verbose=3 is not allowed by its InputDefinition. --verbose does not accept a value (i.e. is VALUE_NONE). It must be passed as short option.

So we enable convertOptions() to pass along short options via a magic value -short. Magic values of true and false are already supported so hopefully this doesnt smell too bad.

This enables a fix for drush-ops/drush#5948

--verbose=3 is not allowed by its InputDefinition. --verbose does not accept a value (i.e. is VALUE_NONE). It must be passed as short option.

So we enable convertOptions() to pass along short options via a magic value `-short`. Magic values of true and false are already supported so hopefully this doesnt smell too bad.

This enables a fix for drush-ops/drush#5909
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.91%. Comparing base (6c44638) to head (0e3927f).

❗ Current head 0e3927f differs from pull request most recent head ef9350f. Consider uploading reports for the commit ef9350f to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #76      +/-   ##
============================================
+ Coverage     77.85%   77.91%   +0.05%     
- Complexity      174      175       +1     
============================================
  Files            20       20              
  Lines           438      498      +60     
============================================
+ Hits            341      388      +47     
- Misses           97      110      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@weitzman
Copy link
Member Author

Test failure looks unrelated.

Copy link
Member

@greg-1-anderson greg-1-anderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this before. I like the functionality that this adds, but I don't like overloading the option value to enable it. Instead, there should be an accessor for the ArgumentProcessor class that takes option names that should remain short. Since the libraries in this org are primarily intended for use with Symfony Console, it would be fine if ArgumentProcessor defaulted to treating -vv and -vvv as short options.

@greg-1-anderson greg-1-anderson merged commit 7910a08 into main Apr 1, 2024
2 of 5 checks passed
@weitzman weitzman deleted the convertOptionsAllowShort branch April 1, 2024 12:46
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.

2 participants