[PATCH 1 of 2] strip leading spaces from all lines of help strings

Eric Bloodworth ergosys at gmail.com
Sat Sep 24 14:04:38 CDT 2005


# HG changeset patch
# User Eric Bloodworth <ergosys at gmail.com>
# Node ID 0de99708f2b50a6721a0d685dabc642cc8755f64
# Parent  e89033eb90a5592062bdc6952a38d7c1becd6fc2
strip leading spaces from all lines of help strings

diff -r e89033eb90a5 -r 0de99708f2b5 mercurial/commands.py
--- a/mercurial/commands.py	Fri Sep 23 19:46:43 2005 -0700
+++ b/mercurial/commands.py	Sat Sep 24 11:29:31 2005 -0700
@@ -391,10 +391,13 @@
         ui.write("%s\n\n" % i[2])
 
         # description
-        doc = i[0].__doc__
+        lines = i[0].__doc__.splitlines(0)
         if ui.quiet:
-            doc = doc.splitlines(0)[0]
-        ui.write("%s\n" % doc.rstrip())
+            doc = lines[0].rstrip()
+        else: 
+            doc = "\n".join([line.lstrip().rstrip() for line in lines])
+
+        ui.write("%s\n" % doc)
 
         if not ui.quiet:
             # aliases


More information about the Mercurial mailing list