##// END OF EJS Templates
gendoc: group commands by category in man page and HTML help...
Sietse Brouwer -
r42435:3816e361 default
parent child Browse files
Show More
@@ -185,8 +185,33 b' def commandprinter(ui, cmdtable, section'
185 h[f] = c
185 h[f] = c
186 cmds = h.keys()
186 cmds = h.keys()
187
187
188 if True:
188 def helpcategory(cmd):
189 for f in sorted(cmds):
189 """Given a canonical command name from `cmds` (above), retrieve its
190 help category. If helpcategory is None, default to CATEGORY_NONE.
191 """
192 fullname = h[cmd]
193 details = cmdtable[fullname]
194 helpcategory = details[0].helpcategory
195 return helpcategory or help.registrar.command.CATEGORY_NONE
196
197 # Print the help for each command. We present the commands grouped by
198 # category, and we use help.CATEGORY_ORDER as a guide for a helpful order
199 # in which to present the categories.
200 cmdsbycategory = {category: [] for category in help.CATEGORY_ORDER}
201 for cmd in cmds:
202 cmdsbycategory[helpcategory(cmd)].append(cmd)
203
204 for category in help.CATEGORY_ORDER:
205 categorycmds = cmdsbycategory[category]
206 if not categorycmds:
207 # Skip empty categories
208 continue
209 # Print a section header for the category.
210 # For now, the category header is at the same level as the headers for
211 # the commands in the category; this is fixed in the next commit.
212 ui.write(sectionfunc(help.CATEGORY_NAMES[category]))
213 # Print each command in the category
214 for f in sorted(categorycmds):
190 if f.startswith(b"debug"):
215 if f.startswith(b"debug"):
191 continue
216 continue
192 d = get_cmd(h[f], cmdtable)
217 d = get_cmd(h[f], cmdtable)
General Comments 0
You need to be logged in to leave comments. Login now