[RFC] Optparse option handling

Aaron Bentley aaron.bentley at utoronto.ca
Tue Aug 15 14:17:12 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> On Fri, 2006-08-11 at 09:06 -0400, Aaron Bentley wrote:
> 
>>>I actually kind of like 'bzr foo --option=baz' for enumeration
>>
>>options,
>>
>>>but I may be unique in this. 
>>
>>It wouldn't be hard to retain --branch-format=foo, (not --format=foo)
>>if
>>that's desirable.
> 
> 
> Curiosity here - why cant we do --format=foo anymore ? [I've been in
> optparse' guts, I dont think theres any fundamental restriction on this]

There were two reasons I didn't want to:
1. repository formats are different from branch formats and working tree
formats.  I would prefer for all our options to be distinct.  This also
allows them to be globally-registered, and referred to with
takes_options=['branch-format'].

2. I'm deriving the option name from the string that is used in the help:

...
  Branch Format:
    --default    The current best format (knit)
...

So "Branch Format" is transformed to "branch-format".  This allows
EnumOptions to be more succinct, which was a big concern of mine-- I
wanted EnumOptions to be a clear win over just invoking parser.add_option.

So no, it has nothing to do with the technical capabilities of optparse.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE4clY0F+nu1YWqI0RAhZnAJ9OrbXnHq61MIFvH+DyWES12bF/OwCgidZP
BXa9ZfqiUUhndZmEub3OGe0=
=Q0r/
-----END PGP SIGNATURE-----




More information about the bazaar mailing list