show value requirement and plurality of option in online help
Martin Geisler
mg at daimi.au.dk
Fri Feb 13 16:41:40 CST 2009
FUJIWARA Katsunori <fujiwara at ascade.co.jp> writes:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1234550162 -32400
> # Node ID a836bf2f40f206bc475660f2b6fad27806cc8b57
> # Parent 935be00913b190e1a954b5b72f68a23a48f0b979
> show value requirement and plurality of option in online help
>
> this helps users to know what kind of option is:
>
> - no value is required(flag option)
> - value is required
> - value is required, and plurality is allowed
>
> each kinds are shown as below:
>
> -f --force force push
> -e --ssh VAL specify ssh command to use
> -r --rev VAL ... a specific revision up to which you would like to push
Nice... I think the 'VAL' should somehow be changeable per option. So it
could be:
-e --ssh CMD specify ssh command to use
-r --rev REV ... a specific revision up to which you would like to push
instead. The 'REV' string can be made by taking the long option, but
'CMD' would have to be yet another argument in the tuples that specify
the commandline flags. I don't know if we want this...
Also, I would remove the space before the '...', so it becomes
-r --rev REV... a specific revision up to which you would like to push
> diff -r 935be00913b1 -r a836bf2f40f2 mercurial/commands.py
> --- a/mercurial/commands.py Sat Feb 14 03:35:52 2009 +0900
> +++ b/mercurial/commands.py Sat Feb 14 03:36:02 2009 +0900
> @@ -1490,8 +1490,13 @@
> opt_output.append(("\n%s" % title, None))
> for shortopt, longopt, default, desc in options:
> if "DEPRECATED" in desc and not ui.verbose: continue
> - opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
> - longopt and " --%s" % longopt),
> + addendum = ((isinstance(default, list) and ' VAL ...') or
> + (((default is not None) and
> + not isinstance(default, bool)) and ' VAL') or
> + '')
The strings need to be translatable, so they must be run through the _()
function like the others. And 'VAL' is not so nice to translate, maybe
'VALUE' would be better.
> + opt_output.append(("%2s%s" %
> + (shortopt and "-%s" % shortopt,
> + longopt and " --%s%s" % (longopt, addendum)),
> "%s%s" % (desc,
> default
> and _(" (default: %s)") % default
--
Martin Geisler
VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090213/6dd5bb14/attachment.pgp
More information about the Mercurial-devel
mailing list