[PATCH 0 of 2] mq: rename strip --nobackup option to --no-backup (issue2377)

Martin Geisler mg at lazybytes.net
Fri Sep 24 18:04:15 CDT 2010


Frank Kingswood <frank at kingswood-consulting.co.uk> writes:

> On 15/09/10 08:04, Martin Geisler wrote:
>> We discussed this problem a couple of days ago on IRC and I suggested
>> that we remove all '-' from the command line options while parsing them.
>> The code would know the options as 'noupdate', 'nobackup', etc, but we
>> can update the help texts to show a nicer and more uniform set of names.
>
> This would also allow --no-b-acku-p and other crazy options.

Yes :) The idea was simply to make it easy for ourselves to update the
documentation to only mention the canonical form, without having to
custom code it every time.

Maybe a simple alias mechanism is better: when declaring the --no-backup
option we also declare --nobackup as an alias for it. fancyopts should
then register both with getopts and "route" both options to the same
name.

> As Christian says, fancyopts already does the right thing.

No, I was not talking about how it replaces '-' with '_'. That was
introduced five years ago in 34be48b4ca85 but with no reason given.

It lets the rest of the code do

  opts.get('foo_bar')

instead of

  opts.get('foo-bar')

This could be so that one can use **opts to pass the options to a
function as keyword arguments.

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100925/0b8f6b2b/attachment.pgp>


More information about the Mercurial-devel mailing list