From 96ac169f4e407b913e0735a5c36229e0501d66dc Mon Sep 17 00:00:00 2001 From: Calvin Lobo Date: Sun, 4 Feb 2018 18:04:01 -0500 Subject: When calling a submenu command from a higher level, strip off the first argument (which enters the submenu) and pass the rest on to the submenu --- cmd2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd2.py') diff --git a/cmd2.py b/cmd2.py index e7787c8e..a237e1bd 100755 --- a/cmd2.py +++ b/cmd2.py @@ -672,8 +672,9 @@ class AddSubmenu(object): for sub_attr, par_attr in self.shared_attributes.items(): setattr(submenu, sub_attr, getattr(parent_cmd, par_attr)) - if line: - # Execute the command + if line.parsed.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) -- cgit v1.2.1