Negating options

Jan Hudec bulb at ucw.cz
Mon Feb 6 16:15:24 GMT 2006


On Mon, Feb 06, 2006 at 10:00:33 -0500, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Martin Pool wrote:
> > Yes, I'd strongly prefer that it be '--no-reprocess' rather than '--no
> > reprocess'.
> 
> Okay.
> 
> > In many other programs, negative options only apply to options without
> > arguments that are either present or not.  In that pattern, it would not
> > make sense to say --no-message.  (But then, that does sound like a
> > useful option.)
> 
> For options that take arguments, "--no-foo" might be equivalent to
> "--foo ''".

More precisely it should cancel out any previous mentioning of that
option. So that you could have --foo=something in the defaults/aliases
config and --no-foo would cancel it.

> > Rather than duplicating the options by hand it might be nice to change
> > the Option class to allow inversion systematically.  There are a few
> > options (as you might say):
> > 
> >  [a] allow --no for Options that specifically say they can be inverted
> > 
> >  [b] allow --no to be prefixed to just any option, even if it does nothing
> > 
> >  [c] allow --no to be prefixed to any boolean option whose default is 
> >      True, or others where it's specifically allowed
> 
> Hmm.  I like [c] or maybe [b], but how about:
> [d] as with [c], but also invert negative options, so that
> - --no-reprocess implies --reprocess?

... instead of --no-no-reprocess ;-). Yes.

> > One nice thing about [c] is that we can show the --no options in the
> > help message for these cases; you could optionally give a different help
> > message for the negative case.

Each option would only ever be written one way in help. If it was
specified as positive, description would apply to the positive form and
default would be off. If it was specified as negative, description would
apply to the negative form and default would be on.

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060206/0f2e86b7/attachment.pgp 


More information about the bazaar mailing list