Skip to content
Snippets Groups Projects
Commit 94f64af5 authored by richardmaw-codethink's avatar richardmaw-codethink
Browse files

cli: Add artifact list-contents subcommand

parent 2ca28df6
No related branches found
No related tags found
1 merge request!1008WIP: Add artifact checkout, list, list-contents, delete and diff subcommands
......@@ -1212,6 +1212,37 @@ def artifact_list(app, null, artifact_prefix):
end=sentinel)
##########################################################################
# Artifact List Contents Command #
##########################################################################
@artifact.command(name='list-contents', short_help="List contents of artifacts")
@click.option('--null', '-z', default=False, is_flag=True,
help="Separate tokens with NUL bytes instead of newlines")
@click.argument('artifacts', type=click.Path(), nargs=-1)
@click.pass_obj
def artifact_list_contents(app, null, artifacts):
"""List the contents of artifacts"""
sentinel = '\0' if null else '\n'
with app.initialized():
cache = app.context.artifactcache
elements, artifacts = _classify_artifacts(artifacts, cache.cas,
app.project.directory)
if not elements and not artifacts:
element = app.context.guess_element()
if element is not None:
elements = [element]
vdirs = _load_vdirs(app, elements, artifacts)
for vdir in vdirs:
vdir = vdir.descend(["files"])
print(sentinel.join(vdir.list_relative_paths()), end=sentinel)
##################################################################
# DEPRECATED Commands #
##################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment