diff options
-rwxr-xr-x | cmd2/cmd2.py | 13 | ||||
-rw-r--r-- | tests/test_shlexparsing.py | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index a124c690..7650d660 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -586,7 +586,7 @@ class AddSubmenu(object): def __call__(self, cmd_obj): """Creates a subclass of Cmd wherein the given submenu can be accessed via the given command""" - def enter_submenu(parent_cmd, line): + def enter_submenu(parent_cmd, statement): """ This function will be bound to do_<submenu> and will change the scope of the CLI to that of the submenu. @@ -605,12 +605,13 @@ class AddSubmenu(object): # copy over any shared attributes self._copy_in_shared_attrs(parent_cmd) - if line.parsed.args: + if statement.args: # Remove the menu argument and execute the command in the submenu - line = submenu.parser_manager.parsed(line.parsed.args) - submenu.precmd(line) - ret = submenu.onecmd(line) - submenu.postcmd(ret, line) + submenu.onecmd_plus_hooks(statement.args) + # statement = parent_cmd.command_parser.parseLine(statement.args) + # submenu.precmd(statement) + # ret = submenu.onecmd(statement) + # submenu.postcmd(ret, statement) else: if self.reformat_prompt is not None: prompt = submenu.prompt diff --git a/tests/test_shlexparsing.py b/tests/test_shlexparsing.py index 02dc51d3..b69f1898 100644 --- a/tests/test_shlexparsing.py +++ b/tests/test_shlexparsing.py @@ -18,10 +18,14 @@ Notes: Functions in cmd2.py to be modified: - _complete_statement() +- parsed() - expands aliases and shortcuts Changelog Items: - if self.default_to_shell is true, then redirection and piping is now properly passed to the shell, previously it was truncated - object passed to do_* methods has changed. It no longer is the pyparsing object, it's a new Statement object. A side effect of this is that we now have a clean interface between the parsing logic and the rest of cmd2. If we need to change the parser in the future, we can do it without breaking anything. + +Bugs fixed: +- submenus now all all hooks, it used to just call precmd and postcmd """ import cmd2 |