[argparse] mutually exclusive group with 2 sets of options

Francois Lafont francois.lafont at nospam.invalid
Mon Aug 5 18:13:16 EDT 2013


Le 05/08/2013 16:11, Miki Tebeka a écrit :

> You can probably do something similar using sub commands (http://docs.python.org/2/library/argparse.html#sub-commands).

Yes, but this is not the same syntax. I want this syntax :

my-script (-a -b VALUE-B | -c -d VALUE-D)

I don't want this syntax:

my-script (subcommad-a -b VALUE-B | subcommand-c -d VALUE-D)

In fact, in this post, I have simplified my question to put the stress just on my problem. In the real life, my script already uses the subcommands (and no problem with that). But I need to have mutually exclusive groups with 2 *sets* of options for compatibility reasons with another programs.

-- 
François Lafont



More information about the Python-list mailing list