mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1192315 - Support remainder arguments from predefined parsers in mach, r=gps
Mach has special handling for remainder arguments which previously only worked with the decoration form. Extend this to also work when a command passes in an explict parser --HG-- extra : commitid : ICnYk764Xbc extra : rebase_source : 1518edcb7bef375cbc2931b8da54b015045c8ce1
This commit is contained in:
parent
b1576e7399
commit
399b0b18f5
@ -180,14 +180,20 @@ class CommandAction(argparse.Action):
|
||||
'usage': usage,
|
||||
}
|
||||
|
||||
remainder = None
|
||||
|
||||
if handler.parser:
|
||||
subparser = handler.parser
|
||||
subparser.context = self._context
|
||||
for arg in subparser._actions[:]:
|
||||
if arg.nargs == argparse.REMAINDER:
|
||||
subparser._actions.remove(arg)
|
||||
remainder = (arg.dest,), {'default': arg.default,
|
||||
'nargs': arg.nargs,
|
||||
'help': arg.help}
|
||||
else:
|
||||
subparser = argparse.ArgumentParser(**parser_args)
|
||||
|
||||
remainder = None
|
||||
|
||||
for arg in handler.arguments:
|
||||
# Remove our group keyword; it's not needed here.
|
||||
group_name = arg[1].get('group')
|
||||
|
Loading…
Reference in New Issue
Block a user