Skip to content

Commit 0a26a51

Browse files
committed
Updated comments and documentation.
1 parent 9bda565 commit 0a26a51

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

cmd2/cmd2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ class Cmd:
332332
DEFAULT_EDITOR: ClassVar[str | None] = utils.find_editor()
333333
DEFAULT_PROMPT: ClassVar[str] = "(Cmd) "
334334

335-
# Default category used for documented commands (those with a docstring,
336-
# help function, or argparse decorator) defined in this class that have
335+
# Default category for commands defined in this class which have
337336
# not been explicitly categorized with the @with_category decorator.
338337
# This value is inherited by subclasses but they can set their own
339338
# DEFAULT_CATEGORY to place their commands into a custom category.
@@ -4292,13 +4291,13 @@ def do_help(self, args: argparse.Namespace) -> None:
42924291
self.poutput(Text(self.doc_leader, style=Cmd2Style.HELP_LEADER))
42934292
self.poutput()
42944293

4295-
# Print any categories first and then the remaining documented commands.
4296-
sorted_categories = sorted(cmds_cats.keys(), key=utils.DEFAULT_STR_SORT_KEY)
4297-
all_cmds = {category: cmds_cats[category] for category in sorted_categories}
4298-
42994294
# Used to provide verbose table separation for better readability.
43004295
previous_table_printed = False
43014296

4297+
# Print commands grouped by category
4298+
sorted_categories = sorted(cmds_cats.keys(), key=utils.DEFAULT_STR_SORT_KEY)
4299+
all_cmds = {category: cmds_cats[category] for category in sorted_categories}
4300+
43024301
for category, commands in all_cmds.items():
43034302
if previous_table_printed:
43044303
self.poutput()
@@ -4309,6 +4308,7 @@ def do_help(self, args: argparse.Namespace) -> None:
43094308
if previous_table_printed and help_topics:
43104309
self.poutput()
43114310

4311+
# Print help topics table
43124312
self.print_topics(self.MISC_HEADER, help_topics, 15, 80)
43134313

43144314
else:

cmd2/command_set.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class CommandSet:
2727
``do_``, ``help_``, and ``complete_`` functions differ only in that self is the CommandSet instead of the cmd2 app
2828
"""
2929

30-
# Default category used for documented commands (those with a docstring,
31-
# help function, or argparse decorator) defined in this CommandSet that have
30+
# Default category for commands defined in this CommandSet which have
3231
# not been explicitly categorized with the @with_category decorator.
3332
# This value is inherited by subclasses but they can set their own
3433
# DEFAULT_CATEGORY to place their commands into a custom category.

docs/features/initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Certain things must be initialized within the `__init__()` method of your class
2020

2121
The `cmd2.Cmd` class provides several class-level variables that can be overridden in subclasses to change default behavior across all instances of that class.
2222

23-
- **DEFAULT_CATEGORY**: The default help category for documented commands defined in the class that haven't been explicitly categorized. (Default: `"Cmd2 Commands"`)
23+
- **DEFAULT_CATEGORY**: The default help category for commands defined in the class which haven't been explicitly categorized. (Default: `"Cmd2 Commands"`)
2424
- **DEFAULT_EDITOR**: The default editor program used by the `edit` command.
2525
- **DEFAULT_PROMPT**: The default prompt string. (Default: `"(Cmd) "`)
2626
- **MISC_HEADER**: Header for the help section listing miscellaneous help topics. (Default: `"Miscellaneous Help Topics"`)

0 commit comments

Comments
 (0)