[argparse] mutually exclusive group with 2 sets of options

2013-08-03 Thread Francois Lafont
Hi, Is it possible with argparse to have this syntax for a script? my-script (-a -b VALUE-B | -c -d VALUE-D) I would like to do this with the argparse module. Thanks in advance. -- François Lafont -- http://mail.python.org/mailman/listinfo/python-list

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-04 Thread Francois Lafont
Hello, Up. ;-) Le 04/08/2013 04:10, Francois Lafont a écrit : > Is it possible with argparse to have this syntax for a script? > > my-script (-a -b VALUE-B | -c -d VALUE-D) > > I would like to do this with the argparse module. > > Thanks in advance. I have f

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-05 Thread Francois Lafont
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:

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-05 Thread Francois Lafont
Le 05/08/2013 22:01, Rafael Durán Castañeda a écrit : > I think you are looking for exclusive groups: > > http://docs.python.org/2.7/library/argparse.html#argparse.add_mutually_exclusive_group Yes... but no. The doc explains you can do this: my-script (-b VALUE-B | -d VALUE-D) ie mutally excl

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-06 Thread Francois Lafont
Hi, On relfection, it's clear that: 1. the "(-a -b VALUE-B | -c -d VALUE-D)" syntax is not implemented by the argparse module; 2. and get this syntax with "argparse + hacking" is not very clean. So, finally I'll use the docopt module version 0.6.1. For the inheritance of common options, I'll us

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-06 Thread Francois Lafont
Le 07/08/2013 01:18, Francois Lafont a écrit : > For the inheritance of common options, I'll used something like > that (even if I prefer the oriented object side of the argparse > module): But I admit that this is a very simple and intelligent module. ;-) -- François L