summaryrefslogtreecommitdiff
path: root/cmd2/parsing.py
diff options
context:
space:
mode:
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: