Commit 78112b9c authored by S. Zeid's avatar S. Zeid

[cli/engine/cli:start()] add option to return exit code *and* command instance

parent d67952c2
......@@ -80,7 +80,8 @@ def make_CLI_class():
program = None
version = None
def start(self, argv, parent_cmd=None, default=None.__class__):
def start(self, argv, parent_cmd=None, default=None.__class__,
verbose_return=False):
argv = (["shell"] if not self.__started_any else []) + argv
debug("running", argv, "in a new instance")
cmd, argv = self._lookup(argv, parent_cmd, default)
......@@ -89,6 +90,8 @@ def make_CLI_class():
self.__started_any = True
r = cmd.run(argv)
debug("finished running", argv)
if verbose_return:
return r, cmd
return r
def __call__(self, argv, parent_cmd=None, default=None.__class__):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment