From 2f0df26606a82fea4e61335bae2231b1f8a67b5d Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Sun, 22 May 2016 19:15:35 +0200 Subject: [PATCH] Add subparser handling to parse_qubes_app --- qubes/tools/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qubes/tools/__init__.py b/qubes/tools/__init__.py index 53e83f32..dc0f2c23 100644 --- a/qubes/tools/__init__.py +++ b/qubes/tools/__init__.py @@ -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