def list(self): artifact_cache = ArtifactCache() artifacts = artifact_cache.list() if artifacts: print("Cached artifacts:") for artifact_id, artifact in artifacts.items(): print("%s:" % artifact_id) for alg in SUPPORTED_HASH_ALGORITHMS: print(" %s: %s" % (alg, artifact[alg])) if artifact['names']: print(" names:") for name in artifact['names']: print(" %s" % name) else: print('No artifacts cached!')
def ls(self): artifact_cache = ArtifactCache() artifacts = artifact_cache.list() if artifacts: for artifact_filename, artifact in artifacts.items(): click.echo("\n{}:".format(click.style( artifact_filename.split('.')[0], fg='green', bold=True))) for alg in SUPPORTED_HASH_ALGORITHMS: if alg in artifact and artifact[alg]: click.echo(" {}: {}".format(click.style(alg, bold=True), artifact[alg])) if artifact['names']: click.echo(" {}:".format(click.style("names", bold=True))) for name in artifact['names']: click.echo(" - %s" % name) else: click.echo('No artifacts cached!')