# HG changeset patch # User Matt Mackall # Date 1407832929 18000 # Node ID 8465625f73648d072a81a0c678ef49d03da3949f # Parent 3ba1d7ca3dfdc2b1736e47829cb47edd6ca9f74c help: refactor helplist optlist mess No output changes diff -r 3ba1d7ca3dfd -r 8465625f7364 mercurial/help.py --- a/mercurial/help.py Tue Aug 12 03:25:51 2014 -0500 +++ b/mercurial/help.py Tue Aug 12 03:42:09 2014 -0500 @@ -363,30 +363,24 @@ for t, desc in topics: rst.append(" :%s: %s\n" % (t, desc)) - optlist = [] - if not ui.quiet: - if ui.verbose: - optlist.append((_("global options:"), commands.globalopts)) - if name == 'shortlist': - optlist.append((_('use "hg help" for the full list ' - 'of commands'), ())) + if ui.quiet: + pass + elif ui.verbose: + rst.append(_("\nglobal options:\n")) + rst.append('\n%s\n' % optrst(commands.globalopts, ui.verbose)) + if name == 'shortlist': + rst.append(_('\nuse "hg help" for the full list ' + 'of commands\n')) + else: + if name == 'shortlist': + rst.append(_('\nuse "hg help" for the full list of commands ' + 'or "hg -v" for details\n')) + elif name and not full: + rst.append(_('\nuse "hg help %s" to show the full help ' + 'text\n') % name) else: - if name == 'shortlist': - msg = _('use "hg help" for the full list of commands ' - 'or "hg -v" for details') - elif name and not full: - msg = _('use "hg help %s" to show the full help ' - 'text') % name - else: - msg = _('use "hg -v help%s" to show builtin aliases and ' - 'global options') % (name and " " + name or "") - optlist.append((msg, ())) - - if optlist: - for title, options in optlist: - rst.append('\n%s\n' % title) - if options: - rst.append('\n%s\n' % optrst(options, ui.verbose)) + rst.append(_('\nuse "hg -v help%s" to show builtin aliases and ' + 'global options\n') % (name and " " + name or "")) return rst def helptopic(name):