Skip to content

Commit

Permalink
Merge pull request #237 from tilezen/command-parser-fn
Browse files Browse the repository at this point in the history
Correct function used for parser
  • Loading branch information
rmarianski authored Aug 8, 2017
2 parents 4f3f8ae + 13d10b2 commit 76f8805
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tilequeue/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,16 +1642,20 @@ def tilequeue_main(argv_args=None):
tilequeue_initial_load_wof_neighbourhoods),
('consume-tile-traffic', tilequeue_consume_tile_traffic),
)
for parser_name, func in parser_config:
subparser = subparsers.add_parser(parser_name)

def _make_command_fn(func):
def command_fn(cfg, peripherals, args):
func(cfg, peripherals)
return func(cfg, peripherals)
return command_fn

for parser_name, func in parser_config:
subparser = subparsers.add_parser(parser_name)

# config parameter is shared amongst all parsers, but appears here so
# that it can be given _after_ the name of the command.
subparser.add_argument('--config', required=True,
help='The path to the tilequeue config file.')
command_fn = _make_command_fn(func)
subparser.set_defaults(func=command_fn)

# add "special" commands which take arguments
Expand Down

0 comments on commit 76f8805

Please sign in to comment.