mercurial/commands.py
changeset 8039 18081ce1e630
parent 8038 2ee6769afe82
child 8040 545fb915fe16
--- a/mercurial/commands.py	Thu Apr 09 10:48:07 2009 +0200
+++ b/mercurial/commands.py	Thu Apr 09 14:43:02 2009 +0200
@@ -7,7 +7,7 @@
 
 from node import hex, nullid, nullrev, short
 from i18n import _, gettext
-import os, re, sys
+import os, re, sys, textwrap
 import hg, util, revlog, bundlerepo, extensions, copies, context, error
 import difflib, patch, time, help, mdiff, tempfile, url, encoding
 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
@@ -1532,7 +1532,11 @@
         opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
         for first, second in opt_output:
             if second:
-                ui.write(" %-*s  %s\n" % (opts_len, first, second))
+                # wrap descriptions at 70 characters, just like the
+                # main help texts
+                second = textwrap.wrap(second, width=70 - opts_len - 3)
+                pad = '\n' + ' ' * (opts_len + 3)
+                ui.write(" %-*s  %s\n" % (opts_len, first, pad.join(second)))
             else:
                 ui.write("%s\n" % first)