Mercurial > hg
changeset 22116:161085f87b95
help: roll option list header into option formatter
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 12 Aug 2014 03:53:33 -0500 |
parents | 8465625f7364 |
children | c1d93edcf004 |
files | mercurial/help.py tests/test-help.t |
diffstat | 2 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/help.py Tue Aug 12 03:42:09 2014 -0500 +++ b/mercurial/help.py Tue Aug 12 03:53:33 2014 -0500 @@ -31,7 +31,7 @@ doc = ''.join(rst) return doc -def optrst(options, verbose): +def optrst(header, options, verbose): data = [] multioccur = False for option in options: @@ -59,7 +59,8 @@ data.append((so, lo, desc)) - rst = minirst.maketable(data, 1) + rst = ['\n%s:\n\n' % header] + rst.extend(minirst.maketable(data, 1)) if multioccur: rst.append(_("\n[+] marked option can be specified multiple times\n")) @@ -284,12 +285,11 @@ # options if not ui.quiet and entry[1]: - rst.append('\n%s\n\n' % _("options:")) - rst.append(optrst(entry[1], ui.verbose)) + rst.append(optrst(_("options"), entry[1], ui.verbose)) if ui.verbose: - rst.append('\n%s\n\n' % _("global options:")) - rst.append(optrst(commands.globalopts, ui.verbose)) + rst.append(optrst(_("global options"), + commands.globalopts, ui.verbose)) if not ui.verbose: if not full: @@ -366,8 +366,8 @@ if ui.quiet: pass elif ui.verbose: - rst.append(_("\nglobal options:\n")) - rst.append('\n%s\n' % optrst(commands.globalopts, ui.verbose)) + rst.append('\n%s\n' % optrst(_("global options"), + commands.globalopts, ui.verbose)) if name == 'shortlist': rst.append(_('\nuse "hg help" for the full list ' 'of commands\n'))