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

Fix: "duplicate-arguments-array" should not interfere with "option.nargs" #164

Merged
merged 1 commit into from Jun 7, 2019

Conversation

juergba
Copy link
Contributor

@juergba juergba commented Mar 23, 2019

Description

#closes #118

var args = parse(
    'foo -p x y', {
        narg: { p: 2 },
        configuration: {
            'duplicate-arguments-array': false,
        }
    }
);
console.log(args);         //  { _: [ 'foo' ], p: 'y' }    <== incorrect

the correct output should be:

  • 'foo -p x y' => { _: [ 'foo' ], p: [ 'x', 'y' ] }
  • 'foo -p x y -p a b' => { _: [ 'foo' ], p: [ 'a', 'b' ] }
  • 'foo -p x y z -p a b c' => { _: [ 'foo' ], p: [ 'a', 'b', 'c' ] }

Description of change

  • fix setKey(): nargs has higher priority than duplicate
  • add one test

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 this pull request may close these issues.

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