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
greedy arrays seems not work #393
Comments
same question。Did you solve it? |
I also had this problem then I looked at all the options and if I understood correctly we need to tell the parser that we want it to be converted to array by using the const args = parser(process.argv.slice(2), {
array: ['--foo', 'apple', 'banana', 'cat'],
configuration: {
"greedy-arrays": true
}
}) so I basically pass the arguments array to both the first argument and also to the |
Isn't the correct way just: parser(process.argv.slice(2), {
array: ['foo'],
}) cli --foo apple banana cat I.e. you still need to tell the parser whether to treat an option as an array, before greedy parsing even comes into play. And @banli17 I see you asked the same question in #372. I hope the above answers it. |
how to get
{ _: [ ], foo: ['apple', 'banana', 'cat' ] }
Instead of specifying array: ['foo'],The text was updated successfully, but these errors were encountered: