diff options
Diffstat (limited to 'buildstream/_frontend/cli.py')
-rw-r--r-- | buildstream/_frontend/cli.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 401eda9b6..02ca52e85 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -814,6 +814,8 @@ def workspace_open(app, no_checkout, force, track_, directory, elements): def workspace_close(app, remove_dir, all_, elements): """Close a workspace""" + removed_required_element = False + with app.initialized(): if not (all_ or elements): # NOTE: I may need to revisit this when implementing multiple projects @@ -840,18 +842,20 @@ def workspace_close(app, remove_dir, all_, elements): for element_name in elements: if not app.stream.workspace_exists(element_name): nonexisting.append(element_name) - if (app.stream.workspace_is_required(element_name) and app.interactive and - app.context.prompt_workspace_close_project_inaccessible): - click.echo("Removing '{}' will prevent you from running " - "BuildStream commands from the current directory".format(element_name)) - if not click.confirm('Are you sure you want to close this workspace?'): - click.echo('Aborting', err=True) - sys.exit(-1) if nonexisting: raise AppError("Workspace does not exist", detail="\n".join(nonexisting)) for element_name in elements: app.stream.workspace_close(element_name, remove_dir=remove_dir) + if app.stream.workspace_is_required(element_name): + removed_required_element = True + + # This message is echo'd last, as it's most relevant to the next + # thing the user will type. + if removed_required_element: + click.echo( + "Removed '{}', therefore you can no longer run BuildStream " + "commands from the current directory.".format(element_name), err=True) ################################################################## |