From 70bf9e1a12b89bb913c11fb07893ab4b9cab2576 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Sat, 15 Jun 2019 15:00:59 -0400 Subject: Began work to minimize public API --- cmd2/pyscript_bridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd2/pyscript_bridge.py') diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index 01d283ea..0638f1fb 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -97,7 +97,7 @@ class PyscriptBridge(object): with redirect_stderr(copy_stderr): stop = self._cmd2_app.onecmd_plus_hooks(command, pyscript_bridge_call=True) finally: - with self._cmd2_app.sigint_protection: + with self._cmd2_app._sigint_protection: self._cmd2_app.stdout = copy_cmd_stdout.inner_stream self.stop = stop or self.stop -- cgit v1.2.1 From 181cecb217dd73056b72874d225e34528d484de8 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Sun, 23 Jun 2019 20:38:17 -0400 Subject: Restored a few attributes to be public --- cmd2/pyscript_bridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd2/pyscript_bridge.py') diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index 0638f1fb..01d283ea 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -97,7 +97,7 @@ class PyscriptBridge(object): with redirect_stderr(copy_stderr): stop = self._cmd2_app.onecmd_plus_hooks(command, pyscript_bridge_call=True) finally: - with self._cmd2_app._sigint_protection: + with self._cmd2_app.sigint_protection: self._cmd2_app.stdout = copy_cmd_stdout.inner_stream self.stop = stop or self.stop -- cgit v1.2.1 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