summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2019-11-29 17:05:37 -0700
committerkotfu <kotfu@kotfu.net>2019-11-29 17:05:37 -0700
commitde9e778481069b6d23d5b8ed639b328172633552 (patch)
treec25aa550f92f8606033a7d13b1a060e6c568545c
parent51851b8aa0d685b039a066a3b8efe88aa05b6113 (diff)
downloadcmd2-git-de9e778481069b6d23d5b8ed639b328172633552.tar.gz
Show various attribute documentation approaches for #821
-rw-r--r--cmd2/cmd2.py13
-rw-r--r--docs/api/cmd.rst4
2 files changed, 13 insertions, 4 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 2ed87fdc..9174a3f4 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -133,6 +133,9 @@ class Cmd(cmd.Cmd):
" This command is for internal use and is not intended to be called from the\n"
" command line.")
+ debug = False
+ """Set to True to display a full stack trace when exceptions occur"""
+
# Sorting keys for strings
ALPHABETICAL_SORT_KEY = utils.norm_fold
NATURAL_SORT_KEY = utils.natural_keys
@@ -417,9 +420,13 @@ class Cmd(cmd.Cmd):
def broken_pipe_warning(self) -> str:
"""Message to display if a BrokenPipeError is raised while writing output.
- :meth:`~cmd2.cmd2.Cmd.poutput()` catches BrokenPipeError exceptions and
- outputs the contents of `broken_pipe_warning`. The default value is an
- empty string meaning the BrokenPipeError is silently swallowed.
+ The following methods catch BrokenPipeError exceptions and output this message:
+
+ - :meth:`~cmd2.cmd2.Cmd.poutput()`
+ - :meth:`~cmd2.cmd2.Cmd.ppaged()`
+
+ The default value is an empty string meaning the BrokenPipeError is
+ silently swallowed.
"""
return self.broken_pipe_error
diff --git a/docs/api/cmd.rst b/docs/api/cmd.rst
index ebec17c3..f50db544 100644
--- a/docs/api/cmd.rst
+++ b/docs/api/cmd.rst
@@ -4,6 +4,8 @@ cmd2.Cmd
.. autoclass:: cmd2.cmd2.Cmd
:members:
- .. attribute:: default_error
+ .. attribute:: help_error
+ The error message displayed to the user when they request help for a
+ command with no help defined.