winget-cli
winget-cli copied to clipboard
Configure Behaviors for multiple sources
Configure Behaviors for multiple sources
Sometimes the same package is in multiple sources.
Now the Windows Package Manager has access to the Microsoft Store, the Community Repository, and private sources. We need better behaviors.
Proposed technical implementation details (optional)
One possibility is to have users continue to disambiguate when a package exists in multiple sources. Another possibility is to have a "priority" on sources so the top priority source will be used (unless specified with --source).
My personal preference as a user would be to have the priority of sources, and potentially to have this be configurable through settings. I would imagine that Microsoft Store should have the top priority by default, then community, then private sources. However, I can see a use case where perhaps a user would like a private source or the community repository to have higher priority.
This could be configurable by having a list of sources in the settings file such as:
"SourcePriority": {
"winget" : 1,
"microsoft": 2,
"UserDefined": 0,
"AnotherUDS": 1,
"LowerPriority": -1
}
The higher the number, the higher the priority. If two are tied for priority, then whichever comes first. Any sources that aren't defined in the priority list would be treated as priority 0, with the exception of the community repository and Microsoft store, which could default to 1 and 2 respectively. Any sources which have a defined priority but don't exist in the sources list could be ignored safely.
Edit: related to https://github.com/microsoft/winget-cli/issues/1344#issuecomment-906868451
Currently the user experience isn't great, and it gets worse due to poor searching of the MS Store

My personal preference as a user would be to have the priority of sources, and potentially to have this be configurable through settings. I would imagine that Microsoft Store should have the top priority by default, then community, then private sources. However, I can see a use case where perhaps a user would like a private source or the community repository to have higher priority.
This could be configurable by having a list of sources in the settings file such as:
"SourcePriority": { "winget" : 1, "microsoft": 2, "UserDefined": 0, "AnotherUDS": 1, "LowerPriority": -1 }The higher the number, the higher the priority. If two are tied for priority, then whichever comes first. Any sources that aren't defined in the priority list would be treated as priority 0, with the exception of the community repository and Microsoft store, which could default to 1 and 2 respectively. Any sources which have a defined priority but don't exist in the sources list could be ignored safely.
Edit: related to #1344 (comment)
I wish this had been implemented already. I will add it and comment it out but would any of this conflict with PS Gallery cmdlets or anything else? I am sure not just double-checking.
There shouldn't be any conflict with comments in the settings file. We're expecting the cmdlets to be a wrapper/interface to the COM API longer term. In the short term we will likely use crescendo to wrap the client, so the settings should be honored regardless of how the tool is used.
@denelon Okay, so this will have nothing to do with the settings file. That makes sense as the settings are personalized, while something this big shouldn't be in the settings file.
Another (simplified) proposal: just have a default.
winget source set-default winget or winget source set-default msstore
then when I run winget install powershell:
- if my default source has it, then it automatically installs from the default
- if default doesn't, but one other does, then it automatically installs from there
- if default doesn't, but multiple others do, then it shows the existing "Multiple packages found matching input criteria. Please refine the input." message
@Trenly's proposal is more robust, though, so I'm fine with that as well.
I know WinGet is not a paid product, but this feature is crucial for replacing Chocolatey as the number one package manager. So please don't keep putting it on the backlog.
The user must be able to install using a moniker in the following way:
Winget install 7zip Winget install vlc Winget install dotnet
If you could do this, there would be little point in using Chocolatey anymore.
what is the state of the developement? in my opinion there where already quite a few good ideas, especially from https://github.com/microsoft/winget-cli/issues/1488#issuecomment-923494839 Is there any kind of technical road block? Because this is a really needed basic feature...