@@ -160,6 +160,138 @@ Which yields:
160160 This command can not generate tags with no content, like <br/>
161161
162162
163+ Grouping Commands
164+ =================
165+
166+ By default, the ``help `` command displays::
167+
168+ Documented commands (type help <topic>):
169+ ========================================
170+ alias findleakers pyscript sessions status vminfo
171+ config help quit set stop which
172+ connect history redeploy shell thread_dump
173+ deploy list resources shortcuts unalias
174+ edit load restart sslconnectorciphers undeploy
175+ expire py serverinfo start version
176+
177+ If you have a large number of commands, you can optionally group your commands into categories.
178+ Here's the output from the example ``help_categories.py ``::
179+
180+ Documented commands (type help <topic>):
181+
182+ Application Management
183+ ======================
184+ deploy findleakers redeploy sessions stop
185+ expire list restart start undeploy
186+
187+ Connecting
188+ ==========
189+ connect which
190+
191+ Server Information
192+ ==================
193+ resources serverinfo sslconnectorciphers status thread_dump vminfo
194+
195+ Other
196+ =====
197+ alias edit history py quit shell unalias
198+ config help load pyscript set shortcuts version
199+
200+
201+ There are 2 methods of specifying command categories, using the ``@with_category `` decorator or with the
202+ ``categorize() `` function. Once a single command category is detected, the help output switches to a categorized
203+ mode of display. All commands with an explicit category defined default to the category `Other `.
204+
205+ Using the ``@with_category `` decorator::
206+
207+ @with_category(CMD_CAT_CONNECTING)
208+ def do_which(self, _):
209+ """Which command"""
210+ self.poutput('Which')
211+
212+ Using the ``categorize() `` function:
213+
214+ You can call with a single function::
215+
216+ def do_connect(self, _):
217+ """Connect command"""
218+ self.poutput('Connect')
219+
220+ # Tag the above command functions under the category Connecting
221+ categorize(do_connect, CMD_CAT_CONNECTING)
222+
223+ Or with an Iterable container of functions::
224+
225+ def do_undeploy(self, _):
226+ """Undeploy command"""
227+ self.poutput('Undeploy')
228+
229+ def do_stop(self, _):
230+ """Stop command"""
231+ self.poutput('Stop')
232+
233+ def do_findleakers(self, _):
234+ """Find Leakers command"""
235+ self.poutput('Find Leakers')
236+
237+ # Tag the above command functions under the category Application Management
238+ categorize((do_undeploy,
239+ do_stop,
240+ do_findleakers), CMD_CAT_APP_MGMT)
241+
242+ The ``help `` command also has a verbose option (``help -v `` or ``help --verbose ``) that combines
243+ the help categories with per-command Help Messages::
244+
245+ Documented commands (type help <topic>):
246+
247+ Application Management
248+ ================================================================================
249+ deploy Deploy command
250+ expire Expire command
251+ findleakers Find Leakers command
252+ list List command
253+ redeploy Redeploy command
254+ restart usage: restart [-h] {now,later,sometime,whenever}
255+ sessions Sessions command
256+ start Start command
257+ stop Stop command
258+ undeploy Undeploy command
259+
260+ Connecting
261+ ================================================================================
262+ connect Connect command
263+ which Which command
264+
265+ Server Information
266+ ================================================================================
267+ resources Resources command
268+ serverinfo Server Info command
269+ sslconnectorciphers SSL Connector Ciphers command is an example of a command that contains
270+ multiple lines of help information for the user. Each line of help in a
271+ contiguous set of lines will be printed and aligned in the verbose output
272+ provided with 'help --verbose'
273+ status Status command
274+ thread_dump Thread Dump command
275+ vminfo VM Info command
276+
277+ Other
278+ ================================================================================
279+ alias Define or display aliases
280+ config Config command
281+ edit Edit a file in a text editor.
282+ help List available commands with "help" or detailed help with "help cmd".
283+ history usage: history [-h] [-r | -e | -s | -o FILE | -t TRANSCRIPT] [arg]
284+ load Runs commands in script file that is encoded as either ASCII or UTF-8 text.
285+ py Invoke python command, shell, or script
286+ pyscript Runs a python script file inside the console
287+ quit Exits this application.
288+ set usage: set [-h] [-a] [-l] [settable [settable ...]]
289+ shell Execute a command as if at the OS prompt.
290+ shortcuts Lists shortcuts (aliases) available.
291+ unalias Unsets aliases
292+ version Version command
293+
294+
163295Receiving an argument list
164296==========================
165297
0 commit comments