Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/cli.py
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | for (property_name, supported_mappings) in sorted(properties.items()): | ||||
click.echo("{}:".format(property_name)) | click.echo("{}:".format(property_name)) | ||||
click.echo("\t" + ", ".join(sorted(supported_mappings))) | click.echo("\t" + ", ".join(sorted(supported_mappings))) | ||||
@mapping.command("translate") | @mapping.command("translate") | ||||
@click.argument("mapping-name") | @click.argument("mapping-name") | ||||
@click.argument("file", type=click.File("rb")) | @click.argument("file", type=click.File("rb")) | ||||
def mapping_translate(mapping_name, file): | def mapping_translate(mapping_name, file): | ||||
"""Prints the list of known mappings.""" | """Translates file from mapping-name to codemeta format.""" | ||||
import json | import json | ||||
from swh.indexer import metadata_dictionary | from swh.indexer import metadata_dictionary | ||||
mapping_cls = [ | mapping_cls = [ | ||||
cls for cls in metadata_dictionary.MAPPINGS.values() if cls.name == mapping_name | cls for cls in metadata_dictionary.MAPPINGS.values() if cls.name == mapping_name | ||||
] | ] | ||||
if not mapping_cls: | if not mapping_cls: | ||||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |