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
Add setting to indicate a flag can be set multiple times #111
Comments
I also would like to propose this form when using multiple flag arguments:
if not already supported, and if the multiple property is true, the foo flag value should always be an array even if only one input is passed:
|
Yes, that's already noted:
|
Ah, sorry! |
I considered that form, but it's complicated as it would only work for flags where the value cannot be comma, otherwise it becomes ambiguous. For example, how would it handle this?
|
The author would have to explicitly opt into supporting it if so, like |
@sindresorhus mmh.. didn't thought about that..
It could be a good solution, do you mean |
Yes |
it make sense, i'm looking to other project (yargs for example) to see how they deal with it but it seems they don't support the comma separated values so my idea probably might be bad and the |
@IssueHunt has funded $40.00 to this issue. See it on IssueHunt |
Third time's a charm? #143 |
@sindresorhus has rewarded $36.00 to @ulken. See it on IssueHunt
|
Currently, if you have:
And on the command-line, you do:
You get
'a'
back, but if you do:You get and array back
['a', 'b']
.This is surprising and inconsistent.
Instead, we should allow only one value by default, and add a setting to the flags config to allow multiple for a flag, in which case, it will always return an array, even if there's only one flag.
I imagine it could be something like this:
IssueHunt Summary
ulken has been rewarded.
Backers (Total: $40.00)
Submitted pull Requests
isMultiple
option for flagsTips
The text was updated successfully, but these errors were encountered: