From ba1319f22f9e116a12d525d8d1d50cfe6318db4c Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Wed, 23 Aug 2017 08:28:19 -0400 Subject: Improved what gets printed when running commands from a script with load command and echo is True Previously just the command get printed. Now the prompt and the command gets printed. --- cmd2.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cmd2.py') diff --git a/cmd2.py b/cmd2.py index 2b43e1ae..d22ce41c 100755 --- a/cmd2.py +++ b/cmd2.py @@ -1017,14 +1017,13 @@ class Cmd(cmd.Cmd): if self.cmdqueue: # Run command out of cmdqueue if nonempty (populated by load command or commands at invocation) line = self.cmdqueue.pop(0) + + if self.echo and line != 'eos': + self.poutput('{}{}'.format(self.prompt, line)) else: # Otherwise, read a command from stdin line = self.pseudo_raw_input(self.prompt) - # If echo is on and in the middle of running a script, then echo the line to the output - if self.echo and self._current_script_dir is not None: - self.poutput(line + '\n') - # Run the command along with all associated pre and post hooks stop = self.onecmd_plus_hooks(line) finally: -- cgit v1.2.1