diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-02-05 15:26:58 +0000 |
---|---|---|
committer | Angelos Evripiotis <angelos.evripiotis@gmail.com> | 2019-02-15 13:56:48 +0000 |
commit | c24f2971db15c8ef23fb569f9ee204ade643ec14 (patch) | |
tree | 8f166ae80ebb2ad6280dd54b47ddcb5d6f75f656 /buildstream/_frontend/cli.py | |
parent | 0921ccf40f167ed524a1a2ff7023949f2542e14f (diff) | |
download | buildstream-are_you_sure2.tar.gz |
userconfig: rm really-workspace-close-project-inaccessibleare_you_sure2
Remove the need for the 'really-workspace-close-project-inaccessible'
config option, as well as the option itself.
As agreed on the mailing list [1], all the 'are you sure?' prompts on
workspace reset and close were removed. While that discussion was going
on, this new prompt and option was added. At the 2019 BuildStream
Gathering, it was verbally agreed between myself and Tristan VB that we
would also remove this instance.
It was also agreed that we should have a notice to let the user know
what they'd done, this was already in place if interactive. Moved it to
be unconditional so that there's no difference in non-interactive
behaviour. Made it output to stderr, as it's diagnostic meant for the
user. Made it the last thing echo'd so it's next to the prompt - it's
very relevant to what they type next. Added a test to make sure the text
makes it to stderr in the appropriate case, and not in an inappropriate
one.
This is the last instance of any prompt configuration, so BuildStream
can also forget all of that machinery.
[1] https://mail.gnome.org/archives/buildstream-list/2018-December/msg00111.html
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) ################################################################## |