From a654c659985db4916d06b15d916e553305f3cb41 Mon Sep 17 00:00:00 2001 From: Rebecca Grayson Date: Thu, 8 Aug 2019 10:48:52 +0100 Subject: 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. --- src/buildstream/_frontend/cli.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/buildstream/_frontend/cli.py') 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 `//`. + + """ + 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 # ################################################################### -- cgit v1.2.1