diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2018-12-12 18:46:48 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2019-01-03 18:59:57 +0000 |
commit | 94f64af55eae44f16452228e6f34a2dff47a5c83 (patch) | |
tree | 5881eac485ddaace71e1d1ecbc69def555a617a9 | |
parent | 2ca28df61a4d5b6cefa3aa15c7e8c0b2971f0448 (diff) | |
download | buildstream-94f64af55eae44f16452228e6f34a2dff47a5c83.tar.gz |
cli: Add artifact list-contents subcommand
-rw-r--r-- | buildstream/_frontend/cli.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 5f7a05930..139d902fb 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -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 # ################################################################## |