Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possibility to disable calling main if nested_command is called #126

Merged
merged 1 commit into from
Jun 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plumbum/cli/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def main(self, src, dst):
DESCRIPTION = None
VERSION = None
USAGE = None
CALL_MAIN_IF_NESTED_COMMAND = True

parent = None
nested_command = None
Expand Down Expand Up @@ -345,7 +346,8 @@ def run(cls, argv = sys.argv, exit = True): # @ReservedAssignment
else:
for f, a in ordered:
f(inst, *a)
retcode = inst.main(*tailargs)
if not inst.nested_command or inst.CALL_MAIN_IF_NESTED_COMMAND:
retcode = inst.main(*tailargs)
if not retcode and inst.nested_command:
subapp, argv = inst.nested_command
subapp.parent = inst
Expand Down