Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/cli.py
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | def run(ctx, type, url, options): | ||||
logger.debug(f"kw: {kw}") | logger.debug(f"kw: {kw}") | ||||
visit_date = kw.get("visit_date") | visit_date = kw.get("visit_date") | ||||
if visit_date and isinstance(visit_date, str): | if visit_date and isinstance(visit_date, str): | ||||
visit_date = iso8601.parse_date(visit_date) | visit_date = iso8601.parse_date(visit_date) | ||||
kw["visit_date"] = visit_date | kw["visit_date"] = visit_date | ||||
loader = get_loader(type, url=url, storage=conf["storage"], **kw) | loader = get_loader(type, url=url, storage=conf["storage"], **kw) | ||||
result = loader.load() | result = loader.load() | ||||
click.echo(result) | msg = f"{result} for origin '{url}'" | ||||
directory = kw.get("directory") | |||||
if directory: | |||||
msg = msg + f" and directory '{directory}'" | |||||
click.echo(msg) | |||||
@loader.command(name="list", context_settings=CONTEXT_SETTINGS) | @loader.command(name="list", context_settings=CONTEXT_SETTINGS) | ||||
@click.argument("type", default="all", type=click.Choice(["all"] + SUPPORTED_LOADERS)) | @click.argument("type", default="all", type=click.Choice(["all"] + SUPPORTED_LOADERS)) | ||||
@click.pass_context | @click.pass_context | ||||
def list(ctx, type): | def list(ctx, type): | ||||
"""List supported loaders and optionally their arguments""" | """List supported loaders and optionally their arguments""" | ||||
import inspect | import inspect | ||||
Show All 16 Lines |