File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -64,15 +64,16 @@ def traverse_parser(parser):
6464 for action in parser ._actions :
6565 # was something provided for the argument
6666 if action .dest in self ._args :
67- # was the argument a flag?
68- # TODO: Handle 'narg' and 'append' options
69- if action .option_strings :
70- cmd_str [0 ] += '"{}" "{}" ' .format (action .option_strings [0 ], self ._args [action .dest ])
67+ if isinstance (action , argparse ._SubParsersAction ):
68+ traverse_parser (action .choices [self ._args [action .dest ]])
7169 else :
70+ # was the argument a flag?
71+ if action .option_strings :
72+ cmd_str [0 ] += '{} ' .format (action .option_strings [0 ])
73+
74+ # TODO: Handle 'narg' and 'append' options
7275 cmd_str [0 ] += '"{}" ' .format (self ._args [action .dest ])
7376
74- if isinstance (action , argparse ._SubParsersAction ):
75- traverse_parser (action .choices [self ._args [action .dest ]])
7677 traverse_parser (self ._parser )
7778
7879 func (cmd_str [0 ])
You can’t perform that action at this time.
0 commit comments