Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/cli.py
Show All 34 Lines | def indexer_cli_group(ctx, config_file): | ||||
ctx.ensure_object(dict) | ctx.ensure_object(dict) | ||||
conf = config.read(config_file) | conf = config.read(config_file) | ||||
ctx.obj["config"] = conf | ctx.obj["config"] = conf | ||||
def _get_api(getter, config, config_key, url): | def _get_api(getter, config, config_key, url): | ||||
if url: | if url: | ||||
config[config_key] = {"cls": "remote", "args": {"url": url}} | config[config_key] = {"cls": "remote", "url": url} | ||||
elif config_key not in config: | elif config_key not in config: | ||||
raise click.ClickException("Missing configuration for {}".format(config_key)) | raise click.ClickException("Missing configuration for {}".format(config_key)) | ||||
return getter(**config[config_key]) | return getter(**config[config_key]) | ||||
@indexer_cli_group.group("mapping") | @indexer_cli_group.group("mapping") | ||||
def mapping(): | def mapping(): | ||||
"""Manage Software Heritage Indexer mappings.""" | """Manage Software Heritage Indexer mappings.""" | ||||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |