[Svnmerge] Command line options order

Blair Zajac blair at orcaware.com
Fri Nov 4 14:36:25 PST 2005


Giovanni Bajo wrote:
> Blair Zajac <blair at orcaware.com> wrote:
> 
> 
>>>1) Tweak OptionParser._fancy_getopt code to accept command-specific
>>>option before the command itself is seen on the command line (and I
>>>accept suggestion on how to parse the command line then).
>>
>>How about making all the options parsed by the global option parsing
>>code and have each subcommand throw an error if there's an option it
>>doesn't use.  Kinda the negative of what is currently being done.
> 
> 
> Sounds like a solution. I'm just a bit skeptical about the concept, but I'll
> trust your expertise.

Well, it's your call, since you're coding it :)

In looking at svnmerge.py, I see there's a custom class for dealing with command 
line options, so it's not strictly the getopt module I was expecting before 
looking at it.

Without looking into the code further, I don't have a specific recommendation on 
how to do this.  My initial point was that a subcommand already has a list of 
options it understands, so you could use that list to select or filter from a 
list of potential options, and if there are any options remaining, then you know 
there's an error.  Don't know if this applies to your code.

Blair



More information about the Svnmerge mailing list