summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorCalvin Lobo <calvinlobo@gmail.com>2018-02-04 18:04:01 -0500
committerCalvin Lobo <calvinlobo@gmail.com>2018-02-04 18:04:01 -0500
commit96ac169f4e407b913e0735a5c36229e0501d66dc (patch)
treed7a3d2fa1b15e50ef55f3d6e2a22e05249a509c3 /cmd2.py
parent19021e194bd89b68c0dec8cb9a1a75fd49de6fe6 (diff)
downloadcmd2-git-96ac169f4e407b913e0735a5c36229e0501d66dc.tar.gz
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
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py5
1 files changed, 3 insertions, 2 deletions
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)