changeset 8889:9be824115ee8

help: wrap extension descriptions
author Martin Geisler <mg@lazybytes.net>
date Mon, 22 Jun 2009 00:02:31 +0200
parents bd93d0e0d317
children c487719cccef
files mercurial/help.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help.py	Sun Jun 21 23:17:05 2009 +0200
+++ b/mercurial/help.py	Mon Jun 22 00:02:31 2009 +0200
@@ -5,6 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2, incorporated herein by reference.
 
+import textwrap
 from i18n import _
 import extensions
 
@@ -45,7 +46,11 @@
         return ''
     result = '\n%s\n\n' % header
     for name, desc in sorted(exts.iteritems()):
-        result += ' %s   %s\n' % (name.ljust(maxlength), desc)
+        # wrap desc at 70 characters, just like the main help texts
+        desc = textwrap.wrap(desc, width=70 - maxlength - 4)
+        pad = '\n' + ' ' * (maxlength + 4)
+        result += ' %s   %s\n' % (name.ljust(maxlength),
+                                  pad.join(desc))
     return result
 
 def extshelp():