summaryrefslogtreecommitdiff
path: root/src/buildstream/_frontend/cli.py
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-08-28 15:36:14 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-09-05 12:14:53 +0000
commit9a2c8890c7823b26629f6d62a302955d7ae81bd1 (patch)
treefa8a54853a9893d64e0a3ba877bbf7532cce61e5 /src/buildstream/_frontend/cli.py
parentf35bf5125a776738adb173cfbd01336666a6e076 (diff)
downloadbuildstream-9a2c8890c7823b26629f6d62a302955d7ae81bd1.tar.gz
cli.py: Allow checkout to handle artifact refs
Diffstat (limited to 'src/buildstream/_frontend/cli.py')
-rw-r--r--src/buildstream/_frontend/cli.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 5333be2ea..3fad1664d 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -181,7 +181,7 @@ def override_completions(orig_args, cmd, cmd_param, args, incomplete):
cmd_param.opts == ['--track'] or
cmd_param.opts == ['--track-except']):
return complete_target(args, incomplete)
- if cmd_param.name == 'artifacts':
+ if cmd_param.name == 'artifacts' or cmd_param.name == 'target':
return complete_artifact(orig_args, args, incomplete)
raise CompleteUnhandled()
@@ -1058,10 +1058,10 @@ def artifact_show(app, deps, artifacts):
@click.option('--directory', default=None,
type=click.Path(file_okay=False),
help="The directory to checkout the artifact to")
-@click.argument('element', required=False,
+@click.argument('target', required=False,
type=click.Path(readable=False))
@click.pass_obj
-def artifact_checkout(app, force, deps, integrate, hardlinks, tar, compression, pull_, directory, element):
+def artifact_checkout(app, force, deps, integrate, hardlinks, tar, compression, pull_, directory, target):
"""Checkout contents of an artifact
When this command is executed from a workspace directory, the default
@@ -1083,7 +1083,7 @@ def artifact_checkout(app, force, deps, integrate, hardlinks, tar, compression,
sys.exit(-1)
else:
if directory is None:
- location = os.path.abspath(os.path.join(os.getcwd(), element))
+ location = os.path.abspath(os.path.join(os.getcwd(), target))
else:
location = directory
if location[-4:] == '.bst':
@@ -1103,13 +1103,13 @@ def artifact_checkout(app, force, deps, integrate, hardlinks, tar, compression,
compression = inferred_compression
with app.initialized():
- if not element:
- element = app.project.get_default_target()
- if not element:
+ if not target:
+ target = app.project.get_default_target()
+ if not target:
raise AppError('Missing argument "ELEMENT".')
scope = {'run': Scope.RUN, 'build': Scope.BUILD, 'none': Scope.NONE}
- app.stream.checkout(element,
+ app.stream.checkout(target,
location=location,
force=force,
scope=scope[deps],