argparse -- mutually exclusive sets of arguments?
roy at panix.com
Fri Nov 23 19:46:25 CET 2012
My command either takes two positional arguments (in which case, both
$ command foo bar
or the name of a config file (in which case, the positional arguments
$ command --config file
How can I represent this with argparse; add_mutually_exclusive_group()
isn't quite the right thing. It could specify that foo and --config are
mutually exclusive, but not (as far as I can see) the more complicated
logic described above.
More information about the Python-list