Show More
@@ -40,11 +40,16 b' def get_opts(opts):' | |||||
40 | shortopt, longopt, default, desc, optlabel = opt |
|
40 | shortopt, longopt, default, desc, optlabel = opt | |
41 | else: |
|
41 | else: | |
42 | shortopt, longopt, default, desc = opt |
|
42 | shortopt, longopt, default, desc = opt | |
|
43 | optlabel = _("VALUE") | |||
43 | allopts = [] |
|
44 | allopts = [] | |
44 | if shortopt: |
|
45 | if shortopt: | |
45 | allopts.append("-%s" % shortopt) |
|
46 | allopts.append("-%s" % shortopt) | |
46 | if longopt: |
|
47 | if longopt: | |
47 | allopts.append("--%s" % longopt) |
|
48 | allopts.append("--%s" % longopt) | |
|
49 | if isinstance(default, list): | |||
|
50 | allopts[-1] += " <%s[+]>" % optlabel | |||
|
51 | elif (default is not None) and not isinstance(default, bool): | |||
|
52 | allopts[-1] += " <%s>" % optlabel | |||
48 | desc += default and _(" (default: %s)") % default or "" |
|
53 | desc += default and _(" (default: %s)") % default or "" | |
49 | yield (", ".join(allopts), desc) |
|
54 | yield (", ".join(allopts), desc) | |
50 |
|
55 | |||
@@ -71,8 +76,14 b' def get_cmd(cmd, cmdtable):' | |||||
71 | def showdoc(ui): |
|
76 | def showdoc(ui): | |
72 | # print options |
|
77 | # print options | |
73 | ui.write(minirst.section(_("Options"))) |
|
78 | ui.write(minirst.section(_("Options"))) | |
|
79 | multioccur = False | |||
74 | for optstr, desc in get_opts(globalopts): |
|
80 | for optstr, desc in get_opts(globalopts): | |
75 | ui.write("%s\n %s\n\n" % (optstr, desc)) |
|
81 | ui.write("%s\n %s\n\n" % (optstr, desc)) | |
|
82 | if optstr.endswith("[+]>"): | |||
|
83 | multioccur = True | |||
|
84 | if multioccur: | |||
|
85 | ui.write(_("\n[+] marked option can be specified multiple times\n")) | |||
|
86 | ui.write("\n") | |||
76 |
|
87 | |||
77 | # print cmds |
|
88 | # print cmds | |
78 | ui.write(minirst.section(_("Commands"))) |
|
89 | ui.write(minirst.section(_("Commands"))) | |
@@ -157,12 +168,18 b' def commandprinter(ui, cmdtable, section' | |||||
157 | if opt_output: |
|
168 | if opt_output: | |
158 | opts_len = max([len(line[0]) for line in opt_output]) |
|
169 | opts_len = max([len(line[0]) for line in opt_output]) | |
159 | ui.write(_("Options:\n\n")) |
|
170 | ui.write(_("Options:\n\n")) | |
|
171 | multioccur = False | |||
160 | for optstr, desc in opt_output: |
|
172 | for optstr, desc in opt_output: | |
161 | if desc: |
|
173 | if desc: | |
162 | s = "%-*s %s" % (opts_len, optstr, desc) |
|
174 | s = "%-*s %s" % (opts_len, optstr, desc) | |
163 | else: |
|
175 | else: | |
164 | s = optstr |
|
176 | s = optstr | |
165 | ui.write("%s\n" % s) |
|
177 | ui.write("%s\n" % s) | |
|
178 | if optstr.endswith("[+]>"): | |||
|
179 | multioccur = True | |||
|
180 | if multioccur: | |||
|
181 | ui.write(_("\n[+] marked option can be specified" | |||
|
182 | " multiple times\n")) | |||
166 | ui.write("\n") |
|
183 | ui.write("\n") | |
167 | # aliases |
|
184 | # aliases | |
168 | if d['aliases']: |
|
185 | if d['aliases']: |
General Comments 0
You need to be logged in to leave comments.
Login now