Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

# for free to join this conversation on GitHub. Already have an account? # 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