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 Lafont -- http://mail.pyt

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-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-05 Thread Joseph L. Casale
> I think you are looking for exclusive groups: > > http://docs.python.org/2.7/library/argparse.html#argparse.add_mutually_excl > usive_group No. That links first doc line in that method shows the very point we are all discussing: "Create a mutually exclusive group. argparse will make sure that

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 Rafael Durán Castañeda
El 04/08/13 04:10, Francois Lafont escribió: 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. I think you are looking for exclusive groups: http://docs.python.o

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

2013-08-05 Thread Joseph L. Casale
> You can probably do something similar using sub commands > (http://docs.python.org/2/library/argparse.html#sub-commands). The problem here is that argparse does not pass the subparser into the parsed args and shared args between subparsers need to be declared each time. Come execution time, when

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

2013-08-05 Thread Miki Tebeka
> 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. You can probably do something similar using sub commands (http://docs.python.org/2/library/argparse.html#sub-commands). -- http://mai

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

2013-08-04 Thread Joshua Landau
On 5 August 2013 03:05, Francois Lafont wrote: > 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. >

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 found this post: https://groups.goo