diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-11 13:33:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 13:33:45 -0400 |
commit | c4fbd8fa618b5c48cc38ac5c262d3c1ec53ce9af (patch) | |
tree | 6bbe109ac6bc4dc5082fc8cd8e6cecd6a94ac677 /cmd2/py_bridge.py | |
parent | 0d4be64b6ec76fcf5f87933293dbc7c134a32cf0 (diff) | |
parent | 526ab5325536f91c48867f4497f4b3dd4150f482 (diff) | |
download | cmd2-git-c4fbd8fa618b5c48cc38ac5c262d3c1ec53ce9af.tar.gz |
Merge pull request #918 from python-cmd2/echo_updates
App echo updates
Diffstat (limited to 'cmd2/py_bridge.py')
-rw-r--r-- | cmd2/py_bridge.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd2/py_bridge.py b/cmd2/py_bridge.py index 6624d7ad..0dc04ca6 100644 --- a/cmd2/py_bridge.py +++ b/cmd2/py_bridge.py @@ -74,25 +74,26 @@ class PyBridge: attributes.insert(0, 'cmd_echo') return attributes - def __call__(self, command: str, echo: Optional[bool] = None) -> CommandResult: + def __call__(self, command: str, *, echo: Optional[bool] = None) -> CommandResult: """ Provide functionality to call application commands by calling PyBridge ex: app('help') :param command: command line being run - :param echo: if True, output will be echoed to stdout/stderr while the command runs - this temporarily overrides the value of self.cmd_echo + :param echo: If provided, this temporarily overrides the value of self.cmd_echo while the + command runs. If True, output will be echoed to stdout/stderr. (Defaults to None) + """ if echo is None: echo = self.cmd_echo # This will be used to capture _cmd2_app.stdout and sys.stdout - copy_cmd_stdout = StdSim(self._cmd2_app.stdout, echo) + copy_cmd_stdout = StdSim(self._cmd2_app.stdout, echo=echo) # Pause the storing of stdout until onecmd_plus_hooks enables it copy_cmd_stdout.pause_storage = True # This will be used to capture sys.stderr - copy_stderr = StdSim(sys.stderr, echo) + copy_stderr = StdSim(sys.stderr, echo=echo) self._cmd2_app.last_result = None |