From f6e7d85cb3cd36e566bbd9c6c4178f70afc4acd7 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 6 May 2019 03:22:21 -0400 Subject: Fixed issue where the wrong terminator was being appended by Statement.expanded_command_line() --- CHANGELOG.md | 2 ++ cmd2/parsing.py | 4 +--- tests/test_parsing.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5142c9b..71feca67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## 0.9.13 (TBD, 2019) +* Bug Fixes + * Fixed issue where the wrong terminator was being appended by `Statement.expanded_command_line()` * Enhancements * `pyscript` limits a command's stdout capture to the same period that redirection does. Therefore output from a command's postparsing and finalization hooks isn't saved in the StdSim object. diff --git a/cmd2/parsing.py b/cmd2/parsing.py index 2af8a207..a9e1a52f 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -201,9 +201,7 @@ class Statement(str): def expanded_command_line(self) -> str: """Contains command_and_args plus any ending terminator, suffix, and redirection chars""" rtn = self.command_and_args - if self.multiline_command: - rtn += constants.MULTILINE_TERMINATOR - elif self.terminator: + if self.terminator: rtn += self.terminator if self.suffix: diff --git a/tests/test_parsing.py b/tests/test_parsing.py index 5852309e..09215804 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -492,7 +492,6 @@ def test_parse_alias_on_multiline_command(parser): assert statement.args == statement assert statement == 'has > inside an unfinished command' assert statement.terminator == '' - assert statement.expanded_command_line == statement.multiline_command + ' ' + statement + MULTILINE_TERMINATOR @pytest.mark.parametrize('line,output', [ ('helpalias > out.txt', '>'), -- cgit v1.2.1