diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-01-29 19:24:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-29 19:24:50 -0500 |
commit | 6296d413ac1cee3577c19ba2bbf9da56202dc26d (patch) | |
tree | 8cacaa6175acde73a861de5cba3919f3963073e2 | |
parent | e87cadfbaeda0bb0197ce959107bda0db89514ea (diff) | |
parent | 0196641173d3b4a69876fb4349d6f5caa5603858 (diff) | |
download | cmd2-git-6296d413ac1cee3577c19ba2bbf9da56202dc26d.tar.gz |
Merge pull request #867 from python-cmd2/discoverable_verbose_help
Make verbose help more discoverable
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | cmd2/cmd2.py | 3 | ||||
-rw-r--r-- | docs/features/help.rst | 8 | ||||
-rw-r--r-- | docs/features/initialization.rst | 2 | ||||
-rw-r--r-- | docs/features/os.rst | 4 |
5 files changed, 13 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7065983d..665683bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## 0.9.26 (TBD, 2020) +* Enhancements + * Changed the default help text to make `help -v` more discoverable * Breaking changes * Renamed `locals_in_py` attribute of `cmd2.Cmd` to `self_in_py` * The following public attributes of `cmd2.Cmd` are no longer settable at runtime by end users: diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index f3b7c4a4..34435ed0 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -279,6 +279,9 @@ class Cmd(cmd.Cmd): # The multiline command currently being typed which is used to tab complete multiline commands. self._multiline_in_progress = '' + # Set the header used for the help function's listing of documented functions + self.doc_header = "Documented commands (use 'help -v' for verbose/'help <topic>' for details):" + # The error that prints when no help information can be found self.help_error = "No help on {}" diff --git a/docs/features/help.rst b/docs/features/help.rst index 03e0867b..920516f5 100644 --- a/docs/features/help.rst +++ b/docs/features/help.rst @@ -12,15 +12,15 @@ Categorizing Commands By default, the ``help`` command displays:: - Documented commands (type help <topic>): - ======================================== + Documented commands (use 'help -v' for verbose/'help <topic>' for details): + =========================================================================== alias help ipy py run_pyscript set shortcuts edit history macro quit run_script shell If you have a large number of commands, you can optionally group your commands into categories. Here's the output from the example ``help_categories.py``:: - Documented commands (type help <topic>): + Documented commands (use 'help -v' for verbose/'help <topic>' for details): Application Management ====================== @@ -90,7 +90,7 @@ Using the ``categorize()`` function: The ``help`` command also has a verbose option (``help -v`` or ``help --verbose``) that combines the help categories with per-command Help Messages:: - Documented commands (type help <topic>): + Documented commands (use 'help -v' for verbose/'help <topic>' for details): Application Management ================================================================================ diff --git a/docs/features/initialization.rst b/docs/features/initialization.rst index c5df5af8..46b4ecd2 100644 --- a/docs/features/initialization.rst +++ b/docs/features/initialization.rst @@ -108,6 +108,8 @@ override: support commands that are only available during specific states of the application. This dictionary's keys are the command names and its values are DisabledCommand objects. +- **doc_header**: Set the header used for the help function's listing of + documented functions - **echo**: if ``True``, each command the user issues will be repeated to the screen before it is executed. This is particularly useful when running scripts. This behavior does not occur when running a command at the prompt. diff --git a/docs/features/os.rst b/docs/features/os.rst index 40a7cbf4..b6f9b61f 100644 --- a/docs/features/os.rst +++ b/docs/features/os.rst @@ -49,8 +49,8 @@ loop:: $ python examples/example.py help - Documented commands (type help <topic>): - ======================================== + Documented commands (use 'help -v' for verbose/'help <topic>' for details): + =========================================================================== alias help macro orate quit run_script set shortcuts edit history mumble py run_pyscript say shell speak |