microsoft / microsoft/winget-cli
Add a quick method option to check if a package is already installed
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Description of the new feature / enhancement
When you use winget to check if a certain package has already been installed, winget insists on first downloading (~5 MB) of package update details, even if it is not used at all. This makes iteration of certain package check impossibly slow.
To test, let's assume you have Zoom.Zoom installed.
# winget list -e --id "Zoom.Zoom" 3>&1 2>&1
Name Id Version Available Source
--------------------------------------------
Zoom Zoom.Zoom < 5.12.8964 5.12.10137 winget
# winget list -e --id "Zoom.Zfhoom" 3>&1 2>&1
No installed package found matching input criteria.
# <Wait a few minutes>
# (Measure-Command { winget list -e --id "Zoom.Zoom" 3>&1 2>&1 }).TotalMilliseconds
5661.9551
# (Measure-Command { winget list -e --id "Zoom.Zosdfom" 3>&1 2>&1 }).TotalMilliseconds
1804.6919
This is ok when using it immediately, but still too slow, as it insists on formatting the output and producing text strings and tables. Then as soon as the winget update has timeout has been reached, it also need to download, which takes several seconds.
Either way, way too slow. We need a new option.
Proposed technical implementation details
Create a new and very fast silent query option, that only produce a True or False when asking for a specific package.
Something like using -c, --check:
# winget list -c --id "Zoom.Zoom"
True
# winget list -c --id "Zoom.NoooZoom"
False
Added Bonus
A similar thing could also be beneficial for more control of the online check using winget search. No need to download a new list every time the command is executed. Perhaps by using a -d, --no-download, which would prevent the download of latest data. In this way you could check if a package exists in the remote store, but using the local (and previously downloaded cache).
# winget search -d -c -e --id "Zoom.Zoom"
True
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing option handling for the winget list and search commands, focusing on how package IDs, output formatting, and update-data downloads are processed. Define the behavior for a silent installed-package check and the proposed no-download search option, then verify that matching and non-matching IDs return the requested True or False output without unnecessary downloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, powershell
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100