-
Notifications
You must be signed in to change notification settings - Fork 929
(#669) Add version completion for install and upgrade commands #3728
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
(#669) Add version completion for install and upgrade commands #3728
Conversation
d9257e3
to
2c55b69
Compare
92e322e
to
6817ac3
Compare
@AdmiringWorm is this still in draft, or is this ready for review? |
It is still in draft, waiting on the test kitchen to finish. |
d65d88f
to
a7c35a4
Compare
@gep13 I have opened this for review now, it succeeded internally on the 2016 image, but failed to spin up the 2019 image (but since it succeeded on one of them, I think it is fine). |
Add chocoRemotePackageVersions function to fetch package versions from remote source and integrate it into tab completion for install and upgrade commands with --version option. This enables listing of available versions for a specified package, improving user experience when specifying versions. Add Pester tests to verify version completions appear correctly for various --version input scenarios and cursor positions, ensuring reliable behavior.
Modify GetSortOrder to accept an outputWarnings parameter that controls whether client-side ordering warnings are logged. This prevents unwanted warnings when output is suppressed, improving user experience during quiet or non-regular output scenarios. Update all callers accordingly.
a7c35a4
to
d8f44f0
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 this looks great! Thank you for taking the time to get this added! This will be a big help going forward! |
Description Of Changes
Enhances PowerShell tab completion for Chocolatey
install
andupgrade
commands by dynamically listing available--version
values for a specified package. Specifically:chocoRemotePackageVersions
helper function to query all available versions for a given package viachoco search
.ChocolateyTabExpansion
to detect version requests and emit completions using a match on partial version input.--version
values.2
returns only 2.x).Motivation and Context
Users installing or upgrading packages via Chocolatey sometimes need to specify a version manually. Without completions, this requires knowing exact version strings in advance. This change improves usability by providing context-aware completions for the
--version
parameter based on available versions from the remote source. It also adds comprehensive tests to verify correctness and edge case behavior.Testing
choco install
andchoco upgrade
using various--version
inputs. (--version=
,--version='
and--version=''
. Latest need to have the cursor between the single quotes).Operating Systems Testing
Change Types Made
Change Checklist
Related Issue
ChocolateyTabExpansion.ps1
file with completions for multiple Chocolatey CLI commands #669