From 2fb807845249d68d55fc7cf1bcbff46511c7851e Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Sun, 27 May 2018 17:55:37 -0400 Subject: Fixed bug where preparse() wasn't called before parsing Also: - Deleted postparse() since it was redundant with postparsing_precmd() --- cmd2/cmd2.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'cmd2/cmd2.py') diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 04758ed7..05902a3c 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1619,15 +1619,6 @@ class Cmd(cmd.Cmd): """ return raw - # noinspection PyMethodMayBeStatic - def postparse(self, statement: Statement) -> Statement: - """Hook that runs immediately after parsing the user input. - - :param statement: Statement object populated by parsing - :return: Statement - potentially modified Statement object - """ - return statement - # noinspection PyMethodMayBeStatic def postparsing_precmd(self, statement: Statement) -> Tuple[bool, Statement]: """This runs after parsing the command-line, but before anything else; even before adding cmd to history. @@ -1688,7 +1679,7 @@ class Cmd(cmd.Cmd): import datetime stop = False try: - statement = self._complete_statement(line) + statement = self._complete_statement(self.preparse(line)) (stop, statement) = self.postparsing_precmd(statement) if stop: return self.postparsing_postcmd(stop) -- cgit v1.2.1 From 12cc83b5051e0683e499e372cc66708cbcd3c835 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Sun, 27 May 2018 20:01:54 -0400 Subject: Reverted preparse behavior to where it was (i.e. currently unused) --- cmd2/cmd2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd2/cmd2.py') diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 05902a3c..ce19cda8 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1679,7 +1679,7 @@ class Cmd(cmd.Cmd): import datetime stop = False try: - statement = self._complete_statement(self.preparse(line)) + statement = self._complete_statement(line) (stop, statement) = self.postparsing_precmd(statement) if stop: return self.postparsing_postcmd(stop) -- cgit v1.2.1