diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-06-23 19:43:42 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-06-23 19:43:42 -0400 |
commit | c8381601e4e3b31969ea6108617356572a7d1ca3 (patch) | |
tree | 023e67165ce45eba33739f248c1ee53b7c975d8f /cmd2/cmd2.py | |
parent | c7feaa60e46563cd60c217d27f888a05c9c3439d (diff) | |
download | cmd2-git-c8381601e4e3b31969ea6108617356572a7d1ca3.tar.gz |
Deprecated CmdResult helper class and promoted CommandResult
These classes are subtly different, particularly in terms of their truthiness.
CmdResult
- attributes: out, err, war
- truthy: if err is falsy
CommandResult
- attributes: stdout, stderr, data
- truthy: if err is falsy AND data is not None
So CmdResult was oriented to provide essentially info, error, and warning messages to the user (typically as stirngs), whereas CommandResult is geared towards providing info and error messages to the user as strings in addition to data to the user in a command-specific format which is arbitrary other than it should never be None if the command succeeds.
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index e2fd25fa..3fb5fbda 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3219,7 +3219,7 @@ class Statekeeper(object): class CmdResult(utils.namedtuple_with_two_defaults('CmdResult', ['out', 'err', 'war'])): - """Derive a class to store results from a named tuple so we can tweak dunder methods for convenience. + """DEPRECATED: Derive a class to store results from a named tuple so we can tweak dunder methods for convenience. This is provided as a convenience and an example for one possible way for end users to store results in the self._last_result attribute of cmd2.Cmd class instances. See the "python_scripting.py" example for how it can |