Skip to content

Commit

Permalink
Ensure subparser is required. (ros-infrastructure#683)
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Brameld <[email protected]>
  • Loading branch information
ijnek authored Aug 5, 2022
1 parent 9ca58ee commit 35af61f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bloom/commands/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ def load_generator_description(generator_name):

def create_subparsers(parser, generator_cmds):
metavar = '[' + ' | '.join(generator_cmds) + ']'
subparser = parser.add_subparsers(
subparsers = parser.add_subparsers(
title='generate commands',
metavar=metavar,
description='Call `bloom-generate {0} -h` for help on a each generate command.'.format(metavar),
dest='generator_cmd'
dest='generator_cmd',
required=True
)
for generator_cmd in generator_cmds:
desc = load_generator_description(generator_cmd)
cmd_parser = subparser.add_parser(desc['title'], description=desc['description'])
cmd_parser = subparsers.add_parser(desc['title'], description=desc['description'])
cmd_parser = desc['prepare_arguments'](cmd_parser)
cmd_parser.set_defaults(func=desc['main'])
add_global_arguments(cmd_parser)
Expand Down

0 comments on commit 35af61f

Please sign in to comment.