Skip to content

command line parsing is storing some options multiple times #60

Open
@ThosRTanner

Description

@ThosRTanner

This little program here:

#!/usr/bin/env python

"""
Usage:
    test.py [--to=SITE]... [--] FILE...
    test.py [--to=SITE]... --config CONFIG [[--] FILE...]

Options:
    --config CONFIG     Configuration file.
    --to=SITE           Target site

"""

import docopt

options = docopt.docopt(__doc__)
print(options)

If I run test.py --to a --to b c, I get this output:

{'--': False,
 '--config': None,
 '--to': ['a', 'b', 'b'],
 'FILE': ['c']}

Notice the double occurrence of 'b'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions