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

Docopt prints usage instead of parsing arguments #17

Open
jrop opened this issue Mar 14, 2017 · 0 comments
Open

Docopt prints usage instead of parsing arguments #17

jrop opened this issue Mar 14, 2017 · 0 comments

Comments

@jrop
Copy link

jrop commented Mar 14, 2017

The following example prints the usage and exits, instead of correctly parsing the arguments.

const {docopt} = require("docopt")

const usage = `
A description for my_program

Usage:
  my_program (--param1 PARAM1 | -x PARAM1)
             (--param2 PARAM2 | -y PARAM2)
             [--db DB]
             [--user USER | -u USER]
             [--password PASSWORD | -p PASSWORD]
  my_program (-h | --help | -v | --version)

Options:
  -h --help      Print this help message
  -v --version   Print version
`

const argv = docopt(usage, {
    argv: ['--param1', 'P1', '--param2', 'P2'],
    version: '1.0.0'
})
console.log(argv)

Expected output:

The python version works

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