[PATCH 1 of 1] Display type of each command options in online help document
FUJIWARA Katsunori
fujiwara at ascade.co.jp
Tue Dec 30 03:10:53 CST 2008
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1230163792 -32400
# Node ID e4eaf4c44c4ca08ca905b88fe6a1f7f8d4bf9e3c
# Parent ca044918fdf17f0478d4dfc9ad653bdeccc568b5
Display type of each command options in online help document.
option type marks means:
- F: flag option
- V: value required option
- M: value required option(multiple values are allowed)
diff -r ca044918fdf1 -r e4eaf4c44c4c mercurial/commands.py
--- a/mercurial/commands.py Sun Dec 14 23:05:18 2008 -0800
+++ b/mercurial/commands.py Thu Dec 25 09:09:52 2008 +0900
@@ -1460,11 +1460,17 @@
# list all option lists
opt_output = []
for title, options in option_lists:
- opt_output.append(("\n%s" % title, None))
+ opt_output.append(("\n%s" % title, None, None))
for shortopt, longopt, default, desc in options:
if "DEPRECATED" in desc and not ui.verbose: continue
+ # F(lag), S(ingle value) or M(ultiple value)
+ typelabel = ((isinstance(default, list) and 'M') or
+ (((None == default) or
+ isinstance(default, bool)) and 'F') or
+ 'V')
opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
longopt and " --%s" % longopt),
+ typelabel,
"%s%s" % (desc,
default
and _(" (default: %s)") % default
@@ -1483,9 +1489,10 @@
if opt_output:
opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
- for first, second in opt_output:
+ for first, typelabel, second in opt_output:
if second:
- ui.write(" %-*s %s\n" % (opts_len, first, second))
+ ui.write(" %-*s [%s] %s\n" %
+ (opts_len, first, typelabel, second))
else:
ui.write("%s\n" % first)
More information about the Mercurial-devel
mailing list