summaryrefslogtreecommitdiff
path: root/src/buildstream/_frontend/cli.py
diff options
context:
space:
mode:
authorRebecca Grayson <becky.grayson1@hotmail.co.uk>2019-08-08 10:48:52 +0100
committerRebecca Grayson <becky.grayson1@hotmail.co.uk>2019-08-16 15:27:28 +0100
commita654c659985db4916d06b15d916e553305f3cb41 (patch)
tree6dff2149af44292a83685821a35218d0acda90c1 /src/buildstream/_frontend/cli.py
parentc627b2203cad48881dbbab822b59464de5c7278f (diff)
downloadbuildstream-a654c659985db4916d06b15d916e553305f3cb41.tar.gz
Addition of bst artifact list-contents:
this commit introduces the bst artifact list-contents command. When used it provides the user with a list of the contents within the artifact. Tests and a NEWS entry have also been added for the command.
Diffstat (limited to 'src/buildstream/_frontend/cli.py')
-rw-r--r--src/buildstream/_frontend/cli.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 220d10477..5a585b276 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -1203,6 +1203,25 @@ def artifact_log(app, artifacts):
click.echo_via_pager(data)
+################################################################
+# Artifact List-Contents Command #
+################################################################
+@artifact.command(name='list-contents', short_help="List the contents of an artifact")
+@click.argument('artifacts', type=click.Path(), nargs=-1)
+@click.pass_obj
+def artifact_list_contents(app, artifacts):
+ """List the contents of an artifact.
+
+ Note that 'artifacts' can be element names, which must end in '.bst',
+ or artifact references, which must be in the format `<project_name>/<element>/<key>`.
+
+ """
+ with app.initialized():
+ elements_to_files = app.stream.artifact_list_contents(artifacts)
+ click.echo(app.logger._pretty_print_dictionary(elements_to_files))
+ sys.exit(0)
+
+
###################################################################
# Artifact Delete Command #
###################################################################