Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 15126:d3ad0e9d4be2
help: fold some list help clauses into the helplist function
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 17 Sep 2011 14:46:00 -0500 |
parents | bdc595059108 |
children | 2c80862728cb |
comparison
equal
deleted
inserted
replaced
15125:bdc595059108 | 15126:d3ad0e9d4be2 |
---|---|
2846 hangindent=' ' * (m + 4)))) | 2846 hangindent=' ' * (m + 4)))) |
2847 | 2847 |
2848 if not ui.quiet: | 2848 if not ui.quiet: |
2849 addglobalopts(True) | 2849 addglobalopts(True) |
2850 | 2850 |
2851 if not name: | |
2852 text = help.listexts(_('enabled extensions:'), extensions.enabled()) | |
2853 if text: | |
2854 ui.write("\n%s" % minirst.format(text, textwidth)) | |
2855 | |
2856 ui.write(_("\nadditional help topics:\n\n")) | |
2857 topics = [] | |
2858 for names, header, doc in help.helptable: | |
2859 topics.append((sorted(names, key=len, reverse=True)[0], header)) | |
2860 topics_len = max([len(s[0]) for s in topics]) | |
2861 for t, desc in topics: | |
2862 ui.write(" %-*s %s\n" % (topics_len, t, desc)) | |
2863 | |
2851 def helptopic(name): | 2864 def helptopic(name): |
2852 for names, header, doc in help.helptable: | 2865 for names, header, doc in help.helptable: |
2853 if name in names: | 2866 if name in names: |
2854 break | 2867 break |
2855 else: | 2868 else: |
2941 header = _('basic commands:\n\n') | 2954 header = _('basic commands:\n\n') |
2942 else: | 2955 else: |
2943 header = _('list of commands:\n\n') | 2956 header = _('list of commands:\n\n') |
2944 | 2957 |
2945 helplist(header) | 2958 helplist(header) |
2946 if name != 'shortlist': | |
2947 text = help.listexts(_('enabled extensions:'), extensions.enabled()) | |
2948 if text: | |
2949 ui.write("\n%s" % minirst.format(text, textwidth)) | |
2950 | |
2951 if not name: | |
2952 ui.write(_("\nadditional help topics:\n\n")) | |
2953 topics = [] | |
2954 for names, header, doc in help.helptable: | |
2955 topics.append((sorted(names, key=len, reverse=True)[0], header)) | |
2956 topics_len = max([len(s[0]) for s in topics]) | |
2957 for t, desc in topics: | |
2958 ui.write(" %-*s %s\n" % (topics_len, t, desc)) | |
2959 | 2959 |
2960 ui.write(opttext(optlist, textwidth)) | 2960 ui.write(opttext(optlist, textwidth)) |
2961 | 2961 |
2962 @command('identify|id', | 2962 @command('identify|id', |
2963 [('r', 'rev', '', | 2963 [('r', 'rev', '', |