[PATCH 8 of 8 v2] help: mark boolean flags with a ^ and explain that they can be negated (RFC)

Matt Mackall mpm at selenic.com
Thu Sep 1 17:51:04 UTC 2016


On Wed, 2016-08-31 at 13:10 -0400, Augie Fackler wrote:
> On Wed, Aug 31, 2016 at 12:13 PM, Matt Mackall <mpm at selenic.com> wrote:
> > 
> > On Tue, 2016-08-30 at 16:16 -0400, Augie Fackler wrote:
> > > 
> > > # HG changeset patch
> > > # User Augie Fackler <augie at google.com>
> > > # Date 1472584444 14400
> > > #      Tue Aug 30 15:14:04 2016 -0400
> > > # Node ID 5efc13a760938ff5fd8e4553dd8e06d06b98025b
> > > # Parent  fd68fb86c29873eb32c4a2bd28f7ac0abe3dc172
> > > help: mark boolean flags with a ^ and explain that they can be negated
> > > (RFC)
> > 
> > > 
> > >  options ([+] can be repeated, flags marked ^ can be negated with --no-):
> > The format here is a bit inconsistent. Perhaps:
> > 
> >   options ([+] can be repeated, [?] are flags):
> > 
> > I think actually sticking ^ on the option name itself is a little bizarre
> > and
> > might lead to some minor confusion.
> > 
> > Also, we should probably figure out a way to have aliases for some of these
> > options so we can fully normalize the scheme. Consider:
> > 
> > > 
> > > +   -y --noninteractive^   do not prompt, automatically pick the first
> > > choice
> > Having --no-noninteractive seems really sad. We could make --noninteractive
> > hidden and then advertise --no-interactive as the long version.
> > 
> > Also, I don't think --no-no-backup is a good idea. --backup should be its
> > negation.
> These cases are a bit problematic, because we don't really have a way
> to specify default-true flags.

I was thinking --no-backup would be detected as an inverse. So the parser would
synthesize a --backup option and if it was used bare, opts["no_backup"] would be
set to False rather than None. Maybe that's too convoluted though.

>  Would it be good enough to blacklist
> anything that starts with no- and noninteractive for now?

Yep. Though it's a bit of a shame for fancyopts to acquire such knowledge.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list