Skip to content

Commit ef30d8d

Browse files
committed
Updated docs/features/help.md
1 parent 6b84bd4 commit ef30d8d

File tree

1 file changed

+71
-59
lines changed

1 file changed

+71
-59
lines changed

docs/features/help.md

Lines changed: 71 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ command. The `help` command by itself displays a list of the commands available:
1212
```text
1313
(Cmd) help
1414
15-
Documented commands (use 'help -v' for verbose/'help <topic>' for details):
16-
===========================================================================
15+
Documented Commands
16+
───────────────────
1717
alias help ipy py run_pyscript set shortcuts
1818
edit history macro quit run_script shell
1919
```
@@ -24,9 +24,9 @@ The `help` command can also be used to provide detailed help for a specific comm
2424
(Cmd) help quit
2525
Usage: quit [-h]
2626
27-
Exit this application
27+
Exit this application.
2828
29-
optional arguments:
29+
Optional Arguments:
3030
-h, --help show this help message and exit
3131
```
3232

@@ -37,8 +37,9 @@ help for a command is the docstring for the `do_*` method defining the command -
3737
**foo**, that command is implemented by defining the `do_foo` method and the docstring for that
3838
method is the help.
3939

40-
For commands which use one of the `argparse` decorators to parse arguments, help is provided by
41-
`argparse`. See [Help Messages](./argument_processing.md#help-messages) for more information.
40+
For commands which use the [@with_argparser][cmd2.with_argparser] decorator to parse arguments, help
41+
is provided by `argparse`. See [Help Messages](./argument_processing.md#help-messages) for more
42+
information.
4243

4344
Occasionally there might be an unusual circumstance where providing static help text isn't good
4445
enough and you want to provide dynamic information in the help text for a command. To meet this
@@ -51,42 +52,41 @@ not use an `argparse` decorator because we didn't want different output for `hel
5152

5253
By default, the `help` command displays:
5354

54-
Documented commands (use 'help -v' for verbose/'help <topic>' for details):
55-
===========================================================================
55+
Documented Commands
56+
───────────────────
5657
alias help ipy py run_pyscript set shortcuts
5758
edit history macro quit run_script shell
5859

5960
If you have a large number of commands, you can optionally group your commands into categories.
60-
Here's the output from the example `help_categories.py`:
61-
62-
Documented commands (use 'help -v' for verbose/'help <topic>' for details):
61+
Here's the output from the example
62+
[help_categories.py](https://github.com/python-cmd2/cmd2/blob/main/examples/help_categories.py):
6363

6464
Application Management
65-
======================
65+
──────────────────────
6666
deploy findleakers redeploy sessions stop
6767
expire list restart start undeploy
6868

6969
Command Management
70-
==================
70+
──────────────────
7171
disable_commands enable_commands
7272

7373
Connecting
74-
==========
74+
──────────
7575
connect which
7676

7777
Server Information
78-
==================
78+
──────────────────
7979
resources serverinfo sslconnectorciphers status thread_dump vminfo
8080

8181
Other
82-
=====
83-
alias edit history py run_pyscript set shortcuts
84-
config help macro quit run_script shell version
82+
─────
83+
alias edit history quit run_script shell version
84+
config help macro run_pyscript set shortcuts
8585

86-
There are 2 methods of specifying command categories, using the `@with_category` decorator or with
87-
the `categorize()` function. Once a single command category is detected, the help output switches to
88-
a categorized mode of display. All commands without an explicit category defined default to the
89-
category `Other`.
86+
There are 2 methods of specifying command categories, using the [@with_category][cmd2.with_category]
87+
decorator or with the [categorize()][cmd2.categorize] function. Once a single command category is
88+
detected, the help output switches to a categorized mode of display. All commands without an
89+
explicit category defined default to the category `Other`.
9090

9191
Using the `@with_category` decorator:
9292

@@ -134,58 +134,70 @@ categorize((do_undeploy,
134134
The `help` command also has a verbose option (`help -v` or `help --verbose`) that combines the help
135135
categories with per-command help messages:
136136

137-
Documented commands (use 'help -v' for verbose/'help <topic>' for details):
138-
139137
Application Management
140-
======================================================================================================
141-
deploy Deploy command.
142-
expire Expire command.
143-
findleakers Find Leakers command.
144-
list List command.
145-
redeploy Redeploy command.
146-
restart Restart command.
147-
sessions Sessions command.
148-
start Start command.
149-
stop Stop command.
150-
undeploy Undeploy command.
138+
─────────────────────────────────────
139+
Name Description
140+
─────────────────────────────────────
141+
deploy Deploy command.
142+
expire Expire command.
143+
findleakers Find Leakers command.
144+
list List command.
145+
redeploy Redeploy command.
146+
restart Restart command.
147+
sessions Sessions command.
148+
start Start command.
149+
stop Stop command.
150+
undeploy Undeploy command.
151+
151152

152153
Command Management
153-
======================================================================================================
154-
disable_commands Disable the Application Management commands.
155-
enable_commands Enable the Application Management commands.
154+
─────────────────────────────────────────────────────────────────
155+
Name Description
156+
─────────────────────────────────────────────────────────────────
157+
disable_commands Disable the Application Management commands.
158+
enable_commands Enable the Application Management commands.
159+
156160

157161
Connecting
158-
======================================================================================================
159-
connect Connect command.
160-
which Which command.
162+
────────────────────────────
163+
Name Description
164+
────────────────────────────
165+
connect Connect command.
166+
which Which command.
167+
161168

162169
Server Information
163-
======================================================================================================
170+
─────────────────────────────────────────────────────────────────────────────────────────────────
171+
Name Description
172+
─────────────────────────────────────────────────────────────────────────────────────────────────
164173
resources Resources command.
165174
serverinfo Server Info command.
166175
sslconnectorciphers SSL Connector Ciphers command is an example of a command that contains
167-
multiple lines of help information for the user. Each line of help in a
168-
contiguous set of lines will be printed and aligned in the verbose output
169-
provided with 'help --verbose'.
176+
multiple lines of help information for the user. Each line of help in a
177+
contiguous set of lines will be printed and aligned in the verbose output
178+
provided with 'help --verbose'.
170179
status Status command.
171180
thread_dump Thread Dump command.
172181
vminfo VM Info command.
173182

183+
174184
Other
175-
======================================================================================================
176-
alias Manage aliases.
177-
config Config command.
178-
edit Run a text editor and optionally open a file with it.
179-
help List available commands or provide detailed help for a specific command.
180-
history View, run, edit, save, or clear previously entered commands.
181-
macro Manage macros.
182-
quit Exit this application.
183-
run_pyscript Run Python script within this application's environment.
184-
run_script Run text script.
185-
set Set a settable parameter or show current settings of parameters.
186-
shell Execute a command as if at the OS prompt.
187-
shortcuts List available shortcuts.
188-
version Version command.
185+
─────────────────────────────────────────────────────────────────────────────────────────
186+
Name Description
187+
─────────────────────────────────────────────────────────────────────────────────────────
188+
alias Manage aliases.
189+
config Config command.
190+
edit Run a text editor and optionally open a file with it.
191+
help List available commands or provide detailed help for a specific command.
192+
history View, run, edit, save, or clear previously entered commands.
193+
macro Manage macros.
194+
quit Exit this application.
195+
run_pyscript Run Python script within this application's environment.
196+
run_script Run text script.
197+
set Set a settable parameter or show current settings of parameters.
198+
shell Execute a command as if at the OS prompt.
199+
shortcuts List available shortcuts.
200+
version Version command.
189201

190202
When called with the `-v` flag for verbose help, the one-line description for each command is
191203
provided by the first line of the docstring for that command's associated `do_*` method.

0 commit comments

Comments
 (0)