feat: Add 'singleValue' flag option to assign only one value per multiple flag
This feature aims to address the issue outlined in https://github.com/oclif/oclif/issues/190 to only allow a single value to be assigned for each flag that has the multiple option set. It's a non-breaking change that requires you to include the singleValue boolean in your flag options.
In the command cmd -a foo bar, it's generally accepted that bar becomes a positional argument and should be the default behaviour. Unfortunately, the PR that broke default behaviour has been part of this project for a while now and I feel providing the user an option to change this back would be the best course of action unless a breaking release is planned for oclif.
If this goes through, I'll update and push the relevant changes to the docs repository.
Codecov Report
Merging #79 into master will not change coverage. The diff coverage is
n/a.
@@ Coverage Diff @@
## master #79 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 1 1
Lines 46 29 -17
Branches 21 14 -7
======================================
+ Misses 46 29 -17
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/validate.ts | 0.00% <0.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update dfb4423...9de72fb. Read the comment docs.
Any update on this PR? This is a sorely needed improvement.
This seems like a great approach to the fix. Hopefully this gets reviewed and merged soon.
@cxam thanks for the PR! $ cli foo -a foo bar shouldn't pass bar as a flag. I want to revert that PR's behavior. I'll put this on our project board for looking at next.
I have created a patch of this PR against v3.8.5, if using yarn, you can add the following yarn resolution to packages.json and get this change today while we wait for this to get merged:
"resolutions": {
"@oclif/parser": "https://github.com/caleblloyd/oclif-parser-patch-single-value#v3.8.5"
}