Re: optparse multiple arguments

2006-06-30 Thread Steven Bethard
Ritesh Raj Sarraf wrote: > Now if someone uses it as: > ./foo --my-option a b c > > I want somehow to store all the three arguments Currently optparse doesn't support options with an arbitrary number of arguments. I'm currently working on a optparse-inspired replacement which does support this

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Fredrik Lundh wrote: > Ritesh Raj Sarraf wrote: > > >> http://docs.python.org/lib/optparse-standard-option-actions.html > > > > That won't help because by design of my program, I can't limit the > > number of arguments a user can pass to it. > > do you want options, arguments, or are you just some

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Fredrik Lundh
Ritesh Raj Sarraf wrote: >> http://docs.python.org/lib/optparse-standard-option-actions.html > > That won't help because by design of my program, I can't limit the > number of arguments a user can pass to it. do you want options, arguments, or are you just somewhat confused ? -- http://mai

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Simon Percivall wrote: > > It might do you good to read the documentation instead of blindly > experimenting. > > Anyway, > > parser.add_option("", "--my-option", nargs=3) > > http://docs.python.org/lib/optparse-standard-option-actions.html That won't help because by design of my program, I can't

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Simon Percivall
Ritesh Raj Sarraf wrote: > Ritesh Raj Sarraf wrote: > > I just noticed that the args variable is holding values b and c. > > the args variables comes from: > > (options, args) = parser.parse_args() > > > > I guess I only need to figure out now is why args isn't storing > > argument "a" also... > >

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Fredrik Lundh
Ritesh Raj Sarraf wrote: >> I guess I only need to figure out now is why args isn't storing >> argument "a" also... > > I fixed it, I guess. > > parser.add_option("", "--my-option", dest="my_option", > action="store_true") > > sets my_option to True and the arguments are all stored in the list > "

FIXED: Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Ritesh Raj Sarraf wrote: > I just noticed that the args variable is holding values b and c. > the args variables comes from: > (options, args) = parser.parse_args() > > I guess I only need to figure out now is why args isn't storing > argument "a" also... > > Ritesh I fixed it, I guess. parser.a

Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Ritesh Raj Sarraf wrote: > Hi, > > I'm having some minor problems with optparse. I'm just worried that > someone shouldn't say that multiple argument feature isn't implemented > in optpartse. > > How to tackle multiple arguments to an option ? > As far as I dug, I've found that >1 arguments are be

optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Hi, I'm having some minor problems with optparse. I'm just worried that someone shouldn't say that multiple argument feature isn't implemented in optpartse. How to tackle multiple arguments to an option ? As far as I dug, I've found that >1 arguments are being ignored. parser.add_option("", "--m