changeset 1051:3c918b7ad8da

Clean up displaying help of global options, only one row per option.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 26 Aug 2005 09:15:04 +0200
parents 9c09094de48c
children d8279ca39dc7
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Aug 26 08:47:43 2005 +0200
+++ b/mercurial/commands.py	Fri Aug 26 09:15:04 2005 +0200
@@ -352,17 +352,15 @@
     # global options
     if ui.verbose:
         ui.write("\nglobal options:\n\n")
-        for s, l, d, c in globalopts:
-            opt = ' '
-            if s:
-                opt = opt + '-' + s + ' '
-            if l:
-                opt = opt + '--' + l + ' '
-            if d:
-                opt = opt + '(' + str(d) + ')'
-            ui.write(opt, "\n")
-            if c:
-                ui.write('    %s\n' % c)
+        opts, descriptions = [], []
+        for shortopt, longopt, default, desc in globalopts:
+            opts.append("%2s%s" %
+                        (shortopt and "-%s" % shortopt,
+                         longopt and " --%s" % longopt))
+            descriptions.append(desc)
+        opts_len = max(map(len, opts))
+        for opt, desc in zip(opts, descriptions):
+            ui.write(" %-*s  %s\n" % (opts_len, opt, desc))
 
 # Commands start here, listed alphabetically