Negating options

John A Meinel john at arbash-meinel.com
Sat Feb 4 18:26:50 GMT 2006


Erik Bågfors wrote:
> 2006/2/3, Aaron Bentley <aaron.bentley at utoronto.ca>:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Now that command defaults are on the horizon, (or 'here' in my case)
>> it's usefult to be able to negate boolean options.  I was thinking we
>> could make '--no' be a special option that would negate the option
>> following, like:
>>
>> $ bzr revert --no reprocess --merge-type weave
>>
>> Thoughts?
> 
> Just FYI.
> 
> This is almost what darcs does and it works for them.  This is an
> output from darcs get --help
> 
>       --set-default                  set default repository [DEFAULT]
>       --no-set-default               don't set default repository
>       --set-scripts-executable       make scripts executable
>       --dont-set-scripts-executable  don't make scripts executable
>       --plain-pristine-tree          Use a plain pristine tree [DEFAULT]
>       --no-pristine-tree             Use no pristine tree
> 
> /Erik
> 
> 

I would like to see us be very regular about this, rather than being
proper English.
So while "dont-set-scripts-executable" is better English,
"--no-set-scripts-executable" is more regular, and easier to figure out.

So I would propose that we use either "--no-*" everywhere, or maybe a
mix of "--no-*" and "--non-*". --no- is for actions/nouns, --non- is for
adjectives. --non-empty, --no-default. but while --no-empty is a little
unclear, it is more regular.

As far as using optparse, if we can get it to do what we want "parse
this set of options, then parse this other set of options once the first
have been handled, and we have taken the first non-option as a command
name" I would be happy to use it. My concern is that it doesn't actually
support our use case very well.

We also want to allow commands to introduce options, along with the help
text. And if we can shoe-horn it into our current syntax, so that we
don't have another 10k+ line change it would be nice.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060204/17dab30b/attachment.pgp 


More information about the bazaar mailing list