Bug 1255467 - Ability for a mach command to dispatch to another's subcommand, r=gps

MozReview-Commit-ID: CN8kJU0NrL0

--HG--
extra : rebase_source : 673041aaeaa48cb32c68955e0448737e1ebbc459
This commit is contained in:
Andrew Halberstadt 2016-03-10 11:45:39 -05:00
parent c77c969418
commit 67699efe5c

View File

@ -99,14 +99,16 @@ class MachRegistrar(object):
return result
def dispatch(self, name, context=None, argv=None, **kwargs):
def dispatch(self, name, context=None, argv=None, subcommand=None, **kwargs):
"""Dispatch/run a command.
Commands can use this to call other commands.
"""
# TODO handler.subcommand_handlers are ignored
handler = self.command_handlers[name]
if subcommand:
handler = handler.subcommand_handlers[subcommand]
if handler.parser:
parser = handler.parser
@ -121,5 +123,4 @@ class MachRegistrar(object):
return self._run_command_handler(handler, context=context, **kwargs)
Registrar = MachRegistrar()