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

odd behavior of narg:2 versus duplicate-arguments-array:false #118

Closed
starpit opened this issue Mar 12, 2018 · 1 comment · Fixed by #164
Closed

odd behavior of narg:2 versus duplicate-arguments-array:false #118

starpit opened this issue Mar 12, 2018 · 1 comment · Fixed by #164

Comments

@starpit
Copy link

starpit commented Mar 12, 2018

const P = require('yargs-parser')
P('foo -p x y', { narg: { p: 2 } })
{ _: [ 'foo' ], p: [ 'x', 'y' ] }

i.e. this results in the expected {x:'y'} binding.

whereas:

P('foo -p x y', { narg: { p: 2 }, configuration: {  'duplicate-arguments-array': false } })
{ _: [ 'foo' ], p: 'y' }

which seems buggy, and contrary to the documentation. i would expect the resulting binding to be the same in both cases.

@bcoe
Copy link
Member

bcoe commented Mar 31, 2018

@starpit this does seem incorrect to me; definitely feels like duplicate-arguments-array is interfering with nargs. If you have any more cycles to dig into this, I would happily accept a patch.

Otherwise I've labeled this as a bug and hopefully we can dig into it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants