diff options
-rw-r--r-- | cmd2/parsing.py | 22 | ||||
-rw-r--r-- | tests/test_shlexparsing.py | 3 |
2 files changed, 14 insertions, 11 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py index 41a3ed0b..41ce5743 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -9,7 +9,16 @@ import cmd2 class Command(): """Store the results of a parsed command.""" - pass + def __init__(self, rawinput): + self.raw = rawinput + self.command = None + self.multilineCommand = None + self.args = None + self.terminator = None + self.suffix = None + self.pipeTo = None + self.output = None + self.outputTo = None class CommandParser(): """Parse raw text into command components.""" @@ -28,16 +37,7 @@ class CommandParser(): self.multilineCommands = multilineCommands def parseString(self, rawinput): - result = Command() - result.raw = rawinput - result.command = None - result.multilineCommand = None - result.args = None - result.terminator = None - result.suffix = None - result.pipeTo = None - result.output = None - result.outputTo = None + result = Command(rawinput) # strip C-style and C++-style comments # shlex will handle the python/shell style comments for us diff --git a/tests/test_shlexparsing.py b/tests/test_shlexparsing.py index 5237fd80..5d3c9546 100644 --- a/tests/test_shlexparsing.py +++ b/tests/test_shlexparsing.py @@ -15,6 +15,9 @@ Notes: - C++-style -> // comment - Python/Shell style -> # comment +Functions in cmd2.py to be modified: +- _complete_statement() + """ import cmd2 |