I'm using docopt
to parse command line input in python. I have my docstring:
"""
Usage:
docoptTest.py [options]
Options:
-h --help show this help message and exit
-n --name <name> The name of the specified person
"""
Then I import docopt and parse the arguments and print them:
from docopt import docopt
args = docopt(__doc__)
print(args)
>>> python docoptTest.py -n asdf
{'--help': False,
'--name': 'asdf'}
I tried putting ellipses to allow to input more than one name:
-n --name <name>... The name of the specified person
But I got a usage error. Then I put the ellipses in the initial usage message:
"""
Usage:
docoptTest.py [-n | --name <name>...] [options]
Options:
-h --help show this help message and exit
-n --name The name of the specified person
"""
But the output thinks that --name
is a flag.
>>> python docoptTest.py -n asdf asdf
{'--help': False,
'--name': True,
'<name>': ['asdf', 'asdf']}
How do I fix this?