docopt not working and proceeding

286 Views Asked by At

The following version 0.6.2 docopt string is not working although i dont find any error in it:

"""Usage:
  somecommand.py [-n nos] [-u] [-c] [-s start]

  Options:

  -h    show help
  -u    some reply
  -n    number to fetch
  -c    ask to do it
  -s    start from?
"""

on commandline:

somecommand.py -n 2 -s 5

Usage:
  privateunreadlybrate.py [-n nos] [-u] [-c] [-s start]

the execution does not proceed and it keeps on showing usage for any command entered. So where is the error?

1

There are 1 best solutions below

0
On BEST ANSWER

The 'nos' value also has to be given in the 'options:' part, try this:

"""Usage:
  somecommand.py [-n nos] [-u] [-c] [-s start]

  Options:

  -h        show help
  -u        some reply
  -n nos    number to fetch
  -c        ask to do it
  -s start  start from?
"""