comparison doc/gendoc.py @ 7376:fc06bd17c985

doc: handle shortened command synopses
author Matt Mackall <mpm@selenic.com>
date Fri, 14 Nov 2008 14:12:16 -0600
parents 46456a51e247
children a33d19dcf906
comparison
equal deleted inserted replaced
7375:9f1370130a45 7376:fc06bd17c985
34 def get_cmd(cmd): 34 def get_cmd(cmd):
35 d = {} 35 d = {}
36 attr = table[cmd] 36 attr = table[cmd]
37 cmds = cmd.lstrip("^").split("|") 37 cmds = cmd.lstrip("^").split("|")
38 38
39 d['synopsis'] = attr[2]
40 d['cmd'] = cmds[0] 39 d['cmd'] = cmds[0]
41 d['aliases'] = cmd.split("|")[1:] 40 d['aliases'] = cmd.split("|")[1:]
42 d['desc'] = get_desc(attr[0].__doc__) 41 d['desc'] = get_desc(attr[0].__doc__)
43 d['opts'] = list(get_opts(attr[1])) 42 d['opts'] = list(get_opts(attr[1]))
43
44 s = 'hg ' + cmds[0]
45 if len(attr) > 2:
46 if not attr[2].startswith('hg'):
47 s += attr[2]
48 else:
49 s = attr[2]
50 d['synopsis'] = s
51
44 return d 52 return d
45
46 53
47 def show_doc(ui): 54 def show_doc(ui):
48 def bold(s, text=""): 55 def bold(s, text=""):
49 ui.write("%s\n%s\n%s\n" % (s, "="*len(s), text)) 56 ui.write("%s\n%s\n%s\n" % (s, "="*len(s), text))
50 def underlined(s, text=""): 57 def underlined(s, text=""):