changeset 7376:fc06bd17c985

doc: handle shortened command synopses
author Matt Mackall <mpm@selenic.com>
date Fri, 14 Nov 2008 14:12:16 -0600
parents 9f1370130a45
children 374a6b3ac623
files doc/gendoc.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/doc/gendoc.py	Fri Nov 14 19:10:09 2008 +0100
+++ b/doc/gendoc.py	Fri Nov 14 14:12:16 2008 -0600
@@ -36,14 +36,21 @@
     attr = table[cmd]
     cmds = cmd.lstrip("^").split("|")
 
-    d['synopsis'] = attr[2]
     d['cmd'] = cmds[0]
     d['aliases'] = cmd.split("|")[1:]
     d['desc'] = get_desc(attr[0].__doc__)
     d['opts'] = list(get_opts(attr[1]))
+
+    s = 'hg ' + cmds[0]
+    if len(attr) > 2:
+        if not attr[2].startswith('hg'):
+            s += attr[2]
+        else:
+            s = attr[2]
+    d['synopsis'] = s
+
     return d
 
-
 def show_doc(ui):
     def bold(s, text=""):
         ui.write("%s\n%s\n%s\n" % (s, "="*len(s), text))