From 652122f3c9907a652a9c3a14581bb2aef90bc996 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Sun, 23 Jun 2019 20:49:27 -0400 Subject: Made last_result public and restored the initialization of it in __init__ and associated comment --- cmd2/pyscript_bridge.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd2/pyscript_bridge.py') diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index 01d283ea..ac3dfd40 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -23,7 +23,7 @@ class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr Any combination of these fields can be used when developing a scripting API for a given command. By default stdout, stderr, and stop will be captured for you. If there is additional command specific data, - then write that to cmd2's _last_result member. That becomes the data member of this tuple. + then write that to cmd2's last_result member. That becomes the data member of this tuple. In some cases, the data member may contain everything needed for a command and storing stdout and stderr might just be a duplication of data that wastes memory. In that case, the StdSim can @@ -88,7 +88,7 @@ class PyscriptBridge(object): # This will be used to capture sys.stderr copy_stderr = StdSim(sys.stderr, echo) - self._cmd2_app._last_result = None + self._cmd2_app.last_result = None stop = False try: @@ -105,5 +105,5 @@ class PyscriptBridge(object): result = CommandResult(stdout=copy_cmd_stdout.getvalue(), stderr=copy_stderr.getvalue() if copy_stderr.getvalue() else None, stop=stop, - data=self._cmd2_app._last_result) + data=self._cmd2_app.last_result) return result -- cgit v1.2.1