Open Ashcora opened 1 month ago
Are you familiar with the "Pin" command? I'd like to understand the scenario where the feature suggested wouldn't be achieved by using pinning.
Verification, see below.
Translated it means:
PS C:\Users\tobia> winget pin add --id Discord.Discord Found Discord [Discord.Discord] A PIN already exists for the Discord package. PS C:\Users\tobia> winget pin add --id nomic.gpt4all Found GPT4All [nomic.gpt4all] PIN successfully added
By adding "--force" you are telling WinGet to "ignore" the pin.
Is there a way to force pending installations while excluding specific packages I don’t want to be considered? Sometimes packages need to be updated using the ‘force’ command, but even the pinned ones should be excluded based on our current understanding
But in fact, your proposed adaption works to ignore the pinned ones.
You can run winget upgrade
to see which packages have upgrades available, then you can pass the Id's for the ones you want upgraded to the upgrade command.
winget upgrade <package id 1> <package id 2>
I like the idea for upgrade --all
. I used to use --exclude
in Portage all the time back when I used Gentoo.
Scenarios where this would be useful but pinning would be awkward:
SomeApp
and I don't want it to close on me when the update starts.SomeApp
takes a long time to update - maybe the installer is several GBs in size and my network is slow. Today I have something to do soon, and I know I'd have to cancel the update midway through if it starts, but I would still like to update everything else.In these cases I could do winget upgrade --all --exclude SomeApp
as a one time thing. I could do it with pinning, but since I just want it one time, I would have to add the pin and then remove it later.
Another valid case for this is when there is a separate paid/free version. i.e. MobaXterm (Mobatek.MobaXterm
)
winget upgrade --all --force
will "upgrade" MobaXterm to the free version of the application even if the paid version is installed, because the free version is what's available in the winget repository.
By adding "--force" you are telling WinGet to "ignore" the pin.
This isn't present in the winget-cli help for either pin
or upgrade
... Yes, it's present in the online documentation for pin
, but it's not self-evident. Other similar systems (apt
, etc.) don't override pin
s, so it feels counterintuitive.
Description of the new feature / enhancement
The --exclude option is designed to provide users with more control over their command line operations. This feature allows users to specify a list of IDs that should be excluded from the operation. This is particularly useful in scenarios where the user wants to apply an operation to a large set of items but needs to exclude a few specific ones.
For example, if a user is performing a bulk delete operation but wants to preserve certain items, they could use the --exclude ids option to specify the IDs of the items to be preserved. This saves the user from having to manually separate these items before performing the operation.
Proposed technical implementation details
The --exclude option could be implemented as a command line argument that accepts a list of IDs. These IDs would then be used to filter out the corresponding items from the operation. The key point is that the --exclude ids option provides a way for users to specify a list of IDs to be excluded from the operation, and this list is then used to filter out the corresponding items before the operation is performed.