argopt icon indicating copy to clipboard operation
argopt copied to clipboard

can't handle multiple "usage" messages?

Open sjpb opened this issue 7 years ago • 1 comments

With a docstring like this:

Usage:
    script.py <arg>
    script.py [<cmd>] <arg>

here's what I get for docopt and argopt:

With python script.py a

docopt: docopt: {'<arg>': 'a','<cmd>': None}

argopt:

usage: script.py [-h] arg arg [cmd]
script.py: error: too few arguments

With python script.py run a

docopt: docopt: {'<arg>': 'a','<cmd>': 'run'}

argopt: Namespace(arg='a', cmd='None').

In both cases docopt does what I'd expect?

sjpb avatar Sep 18 '18 19:09 sjpb

In this case you could use

Usage:
    script.py [<cmd>] <arg>

or

Usage:
    script.py <arg> [<cmd>]

What would the use case be? It's not the same as #3

casperdcl avatar Sep 18 '18 22:09 casperdcl