Skip to content

Commit 294bb3a

Browse files
committed
Modified code to stop assuming that subparser lies at certain position
1 parent 151505c commit 294bb3a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/device_management.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ def __init__(self, *args, **kwargs):
5151
"Create or transform a manifest. "
5252
"Use {} [command] -h for help on each command."
5353
).format(self.parser.prog)
54-
subparserActionLength = len(self.parser._subparsers._actions)
55-
initParser = self.parser._subparsers._actions[subparserActionLength-1].choices['init']
54+
for initIndex in range(len(self.parser._subparsers._actions)):
55+
try:
56+
if 'init' in (self.parser._subparsers._actions[initIndex]).choices:
57+
initParser = self.parser._subparsers._actions[initIndex].choices['init']
58+
except TypeError:
59+
pass
5660
initParser.add_argument('--no-developer-cert', help='Do not download the developer certificate')
5761

5862
def _addCreateArgs(self, parser, exclusions=[]):

0 commit comments

Comments
 (0)