Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds --assume-yes to cache clear command to suppress prompts #6212

Closed

Conversation

colindean
Copy link
Contributor

I had a perceived need to blow away my cache entirely and did so with:

for cache in `poetry cache list`; do poetry cache clear $cache --all; done

but was annoyed by having to answer yes for each of the many caches I had. This PR adds an --assume-yes|-y command like apt's that skips prompts.

Potential future work: Add a special syntax poetry cache clear '*' --all --assume-yes or poetry cache implode that will clear all entries in all caches.

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

@neersighted
Copy link
Member

Hi @colindean, thanks for the PR! We actually already have a global --no-interaction, -n flag that is meant to do the exact same thing. It works by making every call to confirm() etc use the default value. It's broken for this command -- I discussed it with @Secrus a couple weeks ago, but I got side-tracked and never investigated personally.

Any chance you two could sync up and you could convert this PR to one that fixes the existing option?

@Secrus
Copy link
Member

Secrus commented Aug 23, 2022

I was summoned.
Like @neersighted stated, we already have --no-interaction flag, coming for all commands from cleo, our CLI framework. Current bug is that here:

delete = self.confirm(f"<question>Delete {entries_count} entries?</>")

you need to add default=True argument to self.confirm method call, for cleo to handle it properly as "if --no-interactions, agree". That's a small, easy fix.

@colindean
Copy link
Contributor Author

Thanks for #6338! I couldn't get around to acting until today and I'm glad the better solution is in, now.

@colindean colindean deleted the cache-clear-assume_yes branch September 2, 2022 16:16
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants