summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-08-17 11:47:55 +0200
committerJürg Billeter <j@bitron.ch>2017-08-17 11:47:55 +0200
commit6ba115065f8168fa1684be338a47f0a65ca3df79 (patch)
tree2db39d87975abbb75cfa2ee21138330747069985
parent7de843dd17f79bf6d4c1fb7213a198fea77cc83f (diff)
downloadbuildstream-shell-command.tar.gz
main.py: Add -c / --command option to `bst shell`shell-command
Fixes #65
-rw-r--r--buildstream/_frontend/main.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index d5dd33ff2..3b6692a9e 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -364,11 +364,13 @@ def show(app, target, variant, deps, except_, order, format):
@click.option('--scope', '-s', default=None,
type=click.Choice(['build', 'run']),
help='Specify element scope to stage')
+@click.option('--command', '-c', metavar='COMMAND', default=None, type=click.STRING,
+ help='Specify command to execute')
@click.option('--variant',
help='A variant of the specified target')
@click.argument('target')
@click.pass_obj
-def shell(app, target, variant, builddir, scope):
+def shell(app, target, variant, builddir, scope, command):
"""Shell into an element's sandbox environment
This can be used either to debug building or to launch
@@ -406,7 +408,8 @@ def shell(app, target, variant, builddir, scope):
sys.exit(-1)
try:
- app.pipeline.target._shell(scope, builddir)
+ exitcode = app.pipeline.target._shell(scope, builddir, command=command)
+ sys.exit(exitcode)
except _BstError as e:
click.echo("")
click.echo("Errors shelling into this pipeline: %s" % str(e))