diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-11 13:34:52 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-11 13:34:52 -0400 |
commit | c5aa3fd31567574a9ed9fa97f7ba7e7083af707f (patch) | |
tree | 1c0043c78e702da2c5e5175d284cc8eeb6d46449 /cmd2/py_bridge.py | |
parent | d815d2cd19a24bac89bd19416fb2b7cd0dadfe03 (diff) | |
parent | c4fbd8fa618b5c48cc38ac5c262d3c1ec53ce9af (diff) | |
download | cmd2-git-c5aa3fd31567574a9ed9fa97f7ba7e7083af707f.tar.gz |
Merge branch 'master' into table_creator
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 |