diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-06-14 12:06:26 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-06-14 12:06:26 -0400 |
commit | d679f727976cdee3a28e15e6d20094a39ddab70a (patch) | |
tree | afeb789fde5fa522782b7870b5283f4202f2e9dd /cmd2/cmd2.py | |
parent | 5635962154ac670a73c7c608f56ceb146e975f3f (diff) | |
download | cmd2-git-d679f727976cdee3a28e15e6d20094a39ddab70a.tar.gz |
Fixed issue where input line was being saved before all of a multiline command had been fully read
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 4c1a1bb6..a36fdbf3 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1917,13 +1917,17 @@ class Cmd(cmd.Cmd): :return: parsed command line as a Statement """ used_macros = [] - orig_line = line + orig_line = None # Continue until all macros are resolved while True: # Make sure all input has been read and convert it to a Statement statement = self._complete_statement(line) + # Save the fully entered line if this is the first loop iteration + if orig_line is None: + orig_line = statement.raw + # Check if this command matches a macro and wasn't already processed to avoid an infinite loop if statement.command in self.macros.keys() and statement.command not in used_macros: used_macros.append(statement.command) @@ -1934,7 +1938,7 @@ class Cmd(cmd.Cmd): break # This will be true when a macro was used - if not statement.multiline_command and orig_line != statement.raw: + if orig_line != statement.raw: # Build a Statement that contains the resolved macro line # but the originally typed line for its raw member. statement = Statement(statement.args, |