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

multiple array arguments are all flattened instead of getting a nested array #688

Closed
laggingreflex opened this issue Oct 24, 2016 · 1 comment · Fixed by yargs/yargs-parser#71

Comments

@laggingreflex
Copy link
Contributor

laggingreflex commented Oct 24, 2016

I have a command option like this:

  volume: {
    type: 'array'
  },

So this works as expected:

command --volume some thing

I get an array ['some', 'thing']

But I expect multiple --volume and in that case it doesn't work (as expected):

command --volume some thing --volume some other thing

I get a flattened array ['some', 'thing', 'some', 'other', 'thing']

The expected result is to get an array of arrays, right? Like had the option been a string I'd get either a string (for single argument), or an array of strings for multiple arguments. Similarly I should expect to get either an array, or an array of arrays, no? Why the flattening?

@bcoe
Copy link
Member

bcoe commented Dec 1, 2016

@laggingreflex both new configuration options are out in yargs@6.5.0; there is one bug fix we should make to yargs-parser, but I didn't feel it was severe enough to block the release.

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 a pull request may close this issue.

2 participants