doc: handle shortened command synopses
authorMatt Mackall <mpm@selenic.com>
Fri, 14 Nov 2008 14:12:16 -0600
changeset 7376 fc06bd17c985
parent 7375 9f1370130a45
child 7377 374a6b3ac623
doc: handle shortened command synopses
doc/gendoc.py
--- 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))