summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-06 16:00:56 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-06 16:00:56 -0400
commit5157a6ee2c13d553854f2a78362e957f3d018870 (patch)
treeb4f1b164c11d611419aa14aabfcc19702996c42d
parenta490975a030cf7a366e6436b141a7c3ff3b9b018 (diff)
downloadcmd2-git-5157a6ee2c13d553854f2a78362e957f3d018870.tar.gz
runcmds_plus_hooks now handles HistoryItems
-rw-r--r--cmd2/cmd2.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 50dbcd79..e2ff068e 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1807,15 +1807,18 @@ class Cmd(cmd.Cmd):
except Exception as ex:
self.perror(ex)
- def runcmds_plus_hooks(self, cmds: List[str]) -> bool:
+ def runcmds_plus_hooks(self, cmds: List[Union[HistoryItem, str]]) -> bool:
"""
Used when commands are being run in an automated fashion like text scripts or history replays.
The prompt and command line for each command will be printed if echo is True.
- :param cmds: command strings suitable for onecmd_plus_hooks
+ :param cmds: commands to run
:return: True if running of commands should stop
"""
for line in cmds:
+ if isinstance(line, HistoryItem):
+ line = line.raw
+
if self.echo:
self.poutput('{}{}'.format(self.prompt, line))