diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:48:33 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:48:33 -0500 |
commit | d1a970bc5853aa6c1c52db923fb9b4d12ada7cf2 (patch) | |
tree | 0f664834a86d6543287cf89ace609f3c0b3ae535 /cmd2/parsing.py | |
parent | f765be2ce360cf104999f1440f1b13e75cbd957c (diff) | |
parent | dddf5d03c6aa9d7a4f6e953fe1529fa3d7743e39 (diff) | |
download | cmd2-git-d1a970bc5853aa6c1c52db923fb9b4d12ada7cf2.tar.gz |
Merged master into this branch and resolved conflicts in CHANGELOG
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r-- | cmd2/parsing.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py index bd3a6900..5ec13fb7 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -188,6 +188,28 @@ class Statement(str): return rtn @property + 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: + rtn += self.terminator + + if self.suffix: + rtn += ' ' + self.suffix + + if self.pipe_to: + rtn += ' | ' + ' '.join(self.pipe_to) + + if self.output: + rtn += ' ' + self.output + if self.output_to: + rtn += ' ' + self.output_to + + return rtn + + @property def argv(self) -> List[str]: """a list of arguments a la sys.argv. @@ -220,7 +242,7 @@ class StatementParser: ): self.allow_redirection = allow_redirection if terminators is None: - self.terminators = [';'] + self.terminators = [constants.MULTILINE_TERMINATOR] else: self.terminators = terminators if multiline_commands is None: |