[RFC] use optparse for option handling
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Jul 12 20:36:46 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
> Aaron Bentley wrote:
>
>>>Here's a bundle that uses optparse as a backend.
> Nice. We've wanted to do this for a while. I wonder if it is appropriate
> for 0.9 with the release being this close... (remember the
> file_ids_involved_by fiasco)
I'm happy to wait 'till after 0.9. [RFC] 'cause of that.
>>>There is one behaviour change: it's now legal to specify the same option
>>>multiple times (the last value is used).
>
>
> I think we want this, though. Mostly, it helps with aliases, since you
> can override the default.
I agree, though we already had aliases special-cased. I think it's
friendlier.
> Also, optparse supports 'list' style arguments, that keep tacking on new
> values. Which might be nice to let us support '-r 1 -r 2'. Though I
> prefer '-r1..2' syntax myself.
What's always bugged me about that was it seemd like the -r was
associated with positional arguments. E.g. look at this:
$ bzr diff . -r 53 ../dev -r 54
What does that look like it does? To me, it looks like it diffs rev 53
in '.' against rev 54 in '../dev'.
Now this:
$ bzr diff . ../dev -r 53 -r 54
I have no idea what this does, even though it's the same arguments and
options as the above.
>>>(btw, is there a way to prevent that string from being interned? I
>>>don't want false negatives from
>>>"if v is not OptionParser.DEFAULT_VALUE")
>
>
> There are a couple possibilities.
Thanks.
> Might be good to have some direct tests on the option parser.
I think I'd test the parser generator first. If the parser doesn't
work, Guido wouldn't have let it get out, would he?
Technically, I'm already increasing code coverage, because I'm
decreasing the amount of non-library code that is untested.
> The code
> itself looks pretty good. But especially without tests I would be more
> content to add it after 0.9 releases, so we have some bzr.dev time to
> ferret out any bugs/complications.
Fine by me.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEtU9O0F+nu1YWqI0RAvqZAJ4/PafCEns08g8Q17cCRSqWjxIqegCdHRDJ
bwN1bPMjbRBTLicj1CkyR70=
=wiTL
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list