Add subparser handling to parse_qubes_app

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-05-22 19:15:35 +02:00
parent 4f0b17cb52
commit 2f0df26606
No known key found for this signature in database
GPG Key ID: 96ED3C3BA19C3DEE

View File

@ -360,6 +360,13 @@ class QubesArgumentParser(argparse.ArgumentParser):
for action in self._actions:
if issubclass(action.__class__, QubesAction):
action.parse_qubes_app(self, namespace)
elif issubclass(action.__class__, argparse._SubParsersAction):
assert hasattr(namespace, 'command')
command = namespace.command
subparser = action._name_parser_map[command]
for subaction in subparser._actions:
if issubclass(subaction.__class__, QubesAction):
subaction.parse_qubes_app(self, namespace)
return namespace