diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-11 13:04:52 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-11 13:04:52 -0400 |
commit | 2bac6bcda3b7c5b2ba7093955acf232dd89f9f0f (patch) | |
tree | 7f5e029e5a079faf14453655292d6ca9f56a6dee /cmd2/py_bridge.py | |
parent | 0d4be64b6ec76fcf5f87933293dbc7c134a32cf0 (diff) | |
download | cmd2-git-2bac6bcda3b7c5b2ba7093955acf232dd89f9f0f.tar.gz |
Made some optional arguments with defaults keyword-only.
Added unit test for echo argument to pyscript app() command.
Removed _relative_load from hidden commands since that command was renamed.
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 |