R
Roy Smith
My command either takes two positional arguments (in which case, both
are required):
$ command foo bar
or the name of a config file (in which case, the positional arguments
are forbidden):
$ 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.
are required):
$ command foo bar
or the name of a config file (in which case, the positional arguments
are forbidden):
$ 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.