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

Unexpected repeated arguments when using repeated option. #15

Open
rgrannell1 opened this issue Mar 5, 2016 · 0 comments
Open

Unexpected repeated arguments when using repeated option. #15

rgrannell1 opened this issue Mar 5, 2016 · 0 comments

Comments

@rgrannell1
Copy link

Docopt seems to erroneously repeat arguments when parsing an option block when:

  • it is a repeating option.
  • it has multiple matching options in the same '[ ]' block.

Environment:

  • NodeJS: 5.7.0
  • Docopt: 0.6.2

Test Cases:

const doc = `
Usage:
    foobar [-f X ... | --foo X ...]
Options:
    -f X, --foo X     bar

`
console.log(require('docopt').docopt(doc))
const doc = `
Usage:
    foobar [-f X ...] [--foo X ...]
Options:
    -f X, --foo X    bar.

`
console.log(require('docopt').docopt(doc))

Tests:

👎

<test case 1> -f 1 -f 2 -f 3 -f 4 -f 5 -f 6
{ '--foo': [ '1', '2', '3', '4', '5', '6', '2', '3', '4', '5', '6' ] }

👍

<test case 2> -f 1 -f 2 -f 3 -f 4 -f 5 -f 6
{ '--foo': [ '1', '2', '3', '4', '5', '6' ] }
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

No branches or pull requests

1 participant