summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-07-12 01:04:54 -0400
committerGitHub <noreply@github.com>2018-07-12 01:04:54 -0400
commitea7a4bbd14a41b0e9bdde8d34c666eb35df60c4a (patch)
treea7fa8302d736f526f7aedec1f0c633ca61089dba /cmd2/cmd2.py
parente10afbeb6efe7dd806b04bd53eca615bca5d5ffc (diff)
parent322509957f01ee68fe00d837d118da1e50af19bb (diff)
downloadcmd2-git-ea7a4bbd14a41b0e9bdde8d34c666eb35df60c4a.tar.gz
Merge pull request #466 from python-cmd2/delete_cmdresult
Deleted the CmdResult helper class
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py22
1 files changed, 0 insertions, 22 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 44f3a068..2298f4b9 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3220,25 +3220,3 @@ class Statekeeper(object):
if self.obj:
for attrib in self.attribs:
setattr(self.obj, attrib, getattr(self, attrib))
-
-
-class CmdResult(utils.namedtuple_with_two_defaults('CmdResult', ['out', 'err', 'war'])):
- """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
- be used to enable conditional control flow.
-
- Named tuple attributes
- ----------------------
- out - this is intended to store normal output data from the command and can be of any type that makes sense
- err: str - (optional) this is intended to store an error message and it being non-empty indicates there was an error
- Defaults to an empty string
- war: str - (optional) this is intended to store a warning message which isn't quite an error, but of note
- Defaults to an empty string.
-
- NOTE: Named tuples are immutable. So the contents are there for access, not for modification.
- """
- def __bool__(self) -> bool:
- """If err is an empty string, treat the result as a success; otherwise treat it as a failure."""
- return not self.err