[RFC] use optparse for option handling
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 14 04:05:42 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley wrote:
> John Arbash Meinel wrote:
>>> I think you want 'store_false' not 'store_const'. I think by doing
>>> 'store_const' it is using the default 'const=None', so you get None
>>> back, not False.
>
> Normally, yes, but there are bits of the codebase that misbehave if the
> value exists but is set to False. This way imitates the way the system
> currently works most closely. Naturally, I'd prefer to fix the code
> that's misbehaving when the value's set to False.
>
...
> What do you mean by 'weird coupling'?
Just places where the English natural negative is: --non-foo rather than
- --no-foo
Like --no-verbose, --non-verbose is more grammatical. But probably
consistency out-weighs trying to make it sound lnice.
>
>>>>>>> it's probably good to show both in the help.
>>>>> Okay, so that means we won't want to use optparse to generate our option
>>>>> help, because it wants help for every flag name, and we don't provide
>>>>> text for the inverted help.
>>> Actually, just add the inverted option first. Then you get:
>>>
>>> --other-option help on other-option
>>> --no-foo
>>> --foo help on foo
>>>
>>> I do that all the time.
>
> Okay, that's an option. I was thinking more like:
> --other-option help on other-option
> --foo, --no-foo help on foo
>
> Aaron
I don't believe optparse would let you do that. But it lets you do the
former, which is pretty close. Especially since if the line is long you
would end up with:
- --my-long-option, --no-my-long-option
help on my-long option
Anyway, ending up with:
- --no-my-long-option
- --my-long-option help on my-long option
seems okay.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEtwoGJdeBCYSNAAMRAgNJAJwJGVzFy5wkMPq9kaKkeJHF04TpvQCfd4dR
hH7ZRWRZI23HNhkbnTGsow8=
=aj+m
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list