let parse_args only parse, no continuation

This removes parse_args() from the call stack
It pushes down the test-mocking one level [from parse_args() to main()].
Moves parse_args into a more generic 'modules' parsing direction.
This commit is contained in:
kryofly
2018-01-06 11:21:09 +01:00
parent e6e57e47cf
commit 984204e380
4 changed files with 46 additions and 58 deletions

View File

@@ -136,14 +136,7 @@ def parse_args(args: List[str], description: str):
)
build_subcommands(parser)
parsed_args = parser.parse_args(args)
# No subcommand as been selected
if not hasattr(parsed_args, 'func'):
return parsed_args
parsed_args.func(parsed_args)
return None
return parser.parse_args(args)
def build_subcommands(parser: argparse.ArgumentParser) -> None: