Show More
@@ -38,9 +38,9 def get_opts(opts): | |||
|
38 | 38 | desc += default and _(" (default: %s)") % default or "" |
|
39 | 39 | yield(", ".join(allopts), desc) |
|
40 | 40 | |
|
41 | def get_cmd(cmd): | |
|
41 | def get_cmd(cmd, cmdtable): | |
|
42 | 42 | d = {} |
|
43 | attr = table[cmd] | |
|
43 | attr = cmdtable[cmd] | |
|
44 | 44 | cmds = cmd.lstrip("^").split("|") |
|
45 | 45 | |
|
46 | 46 | d['cmd'] = cmds[0] |
@@ -71,8 +71,22 def show_doc(ui): | |||
|
71 | 71 | |
|
72 | 72 | # print cmds |
|
73 | 73 | section(_("Commands")) |
|
74 | commandprinter(ui, table) | |
|
75 | ||
|
76 | # print topics | |
|
77 | for names, sec, doc in helptable: | |
|
78 | for name in names: | |
|
79 | ui.write(".. _%s:\n" % name) | |
|
80 | ui.write("\n") | |
|
81 | section(sec) | |
|
82 | if hasattr(doc, '__call__'): | |
|
83 | doc = doc() | |
|
84 | ui.write(doc) | |
|
85 | ui.write("\n") | |
|
86 | ||
|
87 | def commandprinter(ui, cmdtable): | |
|
74 | 88 | h = {} |
|
75 | for c, attr in table.items(): | |
|
89 | for c, attr in cmdtable.items(): | |
|
76 | 90 | f = c.split("|")[0] |
|
77 | 91 | f = f.lstrip("^") |
|
78 | 92 | h[f] = c |
@@ -82,7 +96,7 def show_doc(ui): | |||
|
82 | 96 | for f in cmds: |
|
83 | 97 | if f.startswith("debug"): |
|
84 | 98 | continue |
|
85 | d = get_cmd(h[f]) | |
|
99 | d = get_cmd(h[f], cmdtable) | |
|
86 | 100 | # synopsis |
|
87 | 101 | ui.write(".. _%s:\n\n" % d['cmd']) |
|
88 | 102 | ui.write("``%s``\n" % d['synopsis'].replace("hg ","", 1)) |
@@ -104,16 +118,6 def show_doc(ui): | |||
|
104 | 118 | if d['aliases']: |
|
105 | 119 | ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) |
|
106 | 120 | |
|
107 | # print topics | |
|
108 | for names, sec, doc in helptable: | |
|
109 | for name in names: | |
|
110 | ui.write(".. _%s:\n" % name) | |
|
111 | ui.write("\n") | |
|
112 | section(sec) | |
|
113 | if hasattr(doc, '__call__'): | |
|
114 | doc = doc() | |
|
115 | ui.write(doc) | |
|
116 | ui.write("\n") | |
|
117 | 121 | |
|
118 | 122 | if __name__ == "__main__": |
|
119 | 123 | show_doc(sys.stdout) |
General Comments 0
You need to be logged in to leave comments.
Login now