Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct function used for parser #237

Merged
merged 1 commit into from
Aug 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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