summaryrefslogtreecommitdiff
path: root/cmd2/parsing.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-04 22:45:05 -0500
committerGitHub <noreply@github.com>2019-03-04 22:45:05 -0500
commitdddf5d03c6aa9d7a4f6e953fe1529fa3d7743e39 (patch)
tree3219ba44c63c45d90864ed0b44da66267e11f77f /cmd2/parsing.py
parenteb86c739187583a7afdd56e0a9fcf0da212562f1 (diff)
parent6370022f726fec17b28ca27d7d0602803f1c6cb6 (diff)
downloadcmd2-git-dddf5d03c6aa9d7a4f6e953fe1529fa3d7743e39.tar.gz
Merge pull request #635 from python-cmd2/history
Improvements to history command
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r--cmd2/parsing.py24
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: