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/pyscript_bridge.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/pyscript_bridge.py')
-rw-r--r-- | cmd2/pyscript_bridge.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index 9353e611..3f58ab84 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -22,7 +22,7 @@ from .argparse_completer import _RangeAction from .utils import namedtuple_with_defaults -class CommandResult(namedtuple_with_defaults('CmdResult', ['stdout', 'stderr', 'data'])): +class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr', 'data'])): """Encapsulates the results from a command. Named tuple attributes |