Is there a recommended way to leverage argparse to define multiple
usage strings (for example, to illustrated mutually exclusive use
cases). E.g.:
myscript.py [-h] [--version]
myscript.py [-f FOO] infile [infile ...]
The best I've come up with so far is to create sets of specifications
for add_parser. First, create a parser for each set just to get the
usage string, then create a final parser with all arguments and
specify the combined usage strings as the final usage string.
Thanks
Yeah, that sounds like the best you can do currently. The only way you
can currently get two separate usage strings is with subparsers, where
you'd have something like:
myscript.py command1 [-h] [--version]
myscript.py command2 [-f FOO] infile [infile ...]
You might be able to trick subparsers into doing what you want, but it
probably wouldn't be pretty. ;-)
Steve
--
Where did you get that preposterous hypothesis?
Did Steve tell you that?
--- The Hiphopopotamus