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

Winget List - support for version filtering #3050

Open
apcsb opened this issue Mar 6, 2023 · 3 comments
Open

Winget List - support for version filtering #3050

apcsb opened this issue Mar 6, 2023 · 3 comments
Labels
Command-List Issue related to WinGet List Issue-Feature This is a feature request for the Windows Package Manager client.

Comments

@apcsb
Copy link

apcsb commented Mar 6, 2023

Description of the new feature / enhancement

#1155
Hi.

I often need to check if a specific package version is installed, or what version of a specific package is installed.
Currently I have to parse text output, which is not fun, given the variable column names/widths etc.

Proposal: Add a --version argument to the list command similar to search / install / uninstall. Only show matches to that version.
Optionally --version-min and -- version-max and differentiation between "not installed" and "wrong version"

Thanks!

Proposed technical implementation details

winget list <query> [--version <string>]
Only return packages if matching the version

Optional:
winget list <query> [--version-min <string1>] [--version-max <string2>]

Only show if installed version >= min version and/or <= max-version (should support one argument or both together)
Alphanumeric Dot-Version string comparison
Not compatible with --version. Alternatively, make --version support '>', '<', '>=', '<=' and some character for "in between" that is not usually used in versions ('*','~', '<>' etc.) Ex: --version '<=1.2.3a' or --version '1.2.6<>1.3.9a'

Optional: different messages / exit codes for "no package" vs "different version is present"

@apcsb apcsb added the Issue-Feature This is a feature request for the Windows Package Manager client. label Mar 6, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Mar 6, 2023
@denelon denelon removed the Needs-Triage Issue need to be triaged label Mar 6, 2023
@jantari
Copy link

jantari commented Mar 14, 2023

You can already do this with the PowerShell cmdlets for winget, for example:

Get-WinGetPackage -Id Git.Git -Source winget | Where-Object Version -like '2.32.*'

doing a comparison like 1.2.6<>1.3.9a is trickier because not all version numbers are purely numeric. In the simple cases you can do:

Get-WinGetPackage -Id Git.Git -Source winget | Where-Object {
    [Version]$_.Version -gt '2.30' -and [Version]$_.Version -lt '2.40'
}

@Trenly
Copy link
Contributor

Trenly commented Jun 16, 2023

[Policy] Command-List

@denelon
Copy link
Contributor

denelon commented Jul 27, 2023

I think the other useful scenario here is to help clarify when the current installed version is "Unknown".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-List Issue related to WinGet List Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests

4 participants