-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
(#3194) Add command to purge cached queries #3209
(#3194) Add command to purge cached queries #3209
Conversation
f6baa19
to
673aae8
Compare
I am not sure what this is referring to:
I didn't see any warning. Can you confirm what is expected here? |
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs
Outdated
Show resolved
Hide resolved
@pauby can I get you to put your eyes on this section of the PR: https://github.com/chocolatey/choco/pull/3209/files#diff-798be7ca9a8afe2aa34a870384e9b9bfefa7155703b839c1262e3bc798ca02b2R168-R173 Looking for some feedback on the wording of the command help description. Thanks |
@AdmiringWorm just thinking about this as well... can we get some tests added to the CacheCommand class, even just verification that the options are available, etc. Similar to what was done with the export command. If there are any easy wins in terms of Pester tests as well, it would be good to get those added in as well. |
This changes how the help output is implemented in Chocolatey CLI. It adds the handling of outputting the majority of the help output in the class called ChocolateyCommandBase that can be used to writing help documentation easier, and instead of thinking about the structure of the output instead needs to override specific methods to give the information that is needed. Some defaults are additionally handled as well to make common output be easier and more maintainable.
The changes here allows the displaying of what version a command was implemented in more easily. THis gives more information to a user whether a command is available to them ore not when viewing the documentation on the website.
673aae8
to
a4f9f16
Compare
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
a4f9f16
to
2fd8aa6
Compare
When running as in a non-elevated context, a warning will be outputted running as an administrator is required to clean out the system http cache. |
src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs
Show resolved
Hide resolved
794bc0e
to
e567d49
Compare
Running through the tests again, I can't replicate this step:
I see a warning about running as an Administrator when |
e567d49
to
24fd61a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@AdmiringWorm aside from confirmation about Step 3 above, this looks good to me, and I would say is ready to be merged. |
I don't have any specific reason for not adding it. It just seemed to be useful in a remove scenario. I can also add it for listing the cache stats if it makes sense to have it there. EDIT: Actually, looking at the steps again. This may have been an oversight on my part. Let me check |
The changes in this commit adds a new command to Chocolatey CLI that allows the user to clear any cached queries that have been saved on their system. This will clear both system and user level caches when running as an administrator, and user level caches when running in a non-elevated context. Additionally, the ability to only remove expired caches is added as well as just listing how many items has been cached.
The change here updates the editorconfig file to default to using a block body instead of an expression. This helps when using any of the Visual Studio features when generating new methods as it will now create a full method without using expressions for single line methods.
24fd61a
to
47d9f75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@AdmiringWorm thank you very much for getting this added! |
Description Of Changes
The changes in this PR adds a new command to Chocolatey CLI
that allows the user to clear any cached queries that have been saved
on their system.
This will clear both system and user level caches when running as an
administrator, and user level caches when running in a non-elevated
context.
Additionally, the ability to only remove expired caches is added as well
as just listing how many items has been cached.
Motivation and Context
To make it easier for users to clear out any cached items on their system, without having to go to the locations manually.
Testing
What is listed will be highly dependent on your system.
choco cache
in a non-elevated context.choco cache
in an elevated context.choco cache remove
in a non-elevated context.choco cache remove
in a elevated context.choco search chocolatey
with the chocolatey source enabled in both elevated and non-elevated context.choco cache remove --expired
in an elevated contextchoco cache get
Help description check
choco -h
cache
command.choco cache -h
Operating Systems Testing
Change Types Made
Change Checklist
Related Issue
Fixes #3194