I would like to use docopt to parse the command line, which can get the same several times. Can someone explain to me how to do this?
Test example:
#!/usr/bin/env python """ Test program. Usage: test.py -v Options: -v Flag that should be counted """ import docopt print docopt.docopt(__doc__)
If I run this with test.py -v , I get:
{'-v': True}
Where, as if I were running this with test.py -vv , it displays a usage message (indicating that the command line is not valid).
I want to configure option documentation so docopt returns me:
{'-v': 1}
When only 1 -v and:
{'-v': 3}
If, say, the user passes -vvv . This is almost the same functionality as the count action in argparse .
source share