diff mercurial/commands.py @ 8864:cad6370a15cb

help: refactor extensions listing, and show enabled ones in the dedicated topic
author C?dric Duval <cedricduval@free.fr>
date Sat, 20 Jun 2009 20:55:49 +0200
parents f8d00346a62d
children c3e4d3c1d48b
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Jun 20 20:55:43 2009 +0200
+++ b/mercurial/commands.py	Sat Jun 20 20:55:49 2009 +0200
@@ -1483,18 +1483,10 @@
             else:
                 ui.write(' %-*s   %s\n' % (m, f, h[f]))
 
-        exts = list(extensions.extensions())
-        if exts and name != 'shortlist':
-            ui.write(_('\nenabled extensions:\n\n'))
-            maxlength = 0
-            exthelps = []
-            for ename, ext in exts:
-                doc = (gettext(ext.__doc__) or _('(no help text available)'))
-                ename = ename.split('.')[-1]
-                maxlength = max(len(ename), maxlength)
-                exthelps.append((ename, doc.splitlines(0)[0].strip()))
-            for ename, text in exthelps:
-                ui.write(_(' %s   %s\n') % (ename.ljust(maxlength), text))
+        if name != 'shortlist':
+            exts, maxlength = help.enabledextensions()
+            ui.write(help.extensionslisting(_('enabled extensions:'),
+                                            exts, maxlength))
 
         if not ui.quiet:
             addglobalopts(True)