winget-cli
winget-cli copied to clipboard
Pinning/Unpinning should work for non-installed applications without `--id` flag
Brief description of your issue
As seen in https://github.com/microsoft/winget-cli/issues/4161#issue-2129045619, winget pin remove
does not remove pin for an uninstalled application without providing --id
flag. I would expect that if the query is an exact / good enough match for a PackageIdentifier listed in winget pin list
, then winget pin remove <PackageIdentifier>
should just work.
The same extension can be made for winget pin add
where a non-installed application can not be pinned without --id
flag. A matching criteria similar to the one used for winget install/search
can be followed to allow these pins.
If we're concerned about user pinning / unpinning an incorrect package with these enhancements, we can make the flow interactive and ask user in a (y/n) prompt.
Steps to reproduce
From https://github.com/microsoft/winget-cli/issues/4161#issue-2129045619
winget install Stockfish.Stockfish winget pin add Stockfish.Stockfish winget remove Stockfish.Stockfish winget pin remove Stockfish.Stockfish
Expected behavior
Pin removed successfully
Actual behavior
No installed package found matching input criteria.
Environment
Windows Package Manager v1.6.3482
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22621.3007
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.0
Winget Directories
----------------------------------------------------------------------------------------------------------
Logs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Lo…
User Settings %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\Lo…
Portable Links Directory (User) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User) %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root C:\Program Files\WinGet\Packages
Portable Package Root (x86) C:\Program Files (x86)\WinGet\Packages
Installer Downloads %USERPROFILE%\Downloads
Links
---------------------------------------------------------------------------
Privacy Statement https://aka.ms/winget-privacy
License Agreement https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
Admin Setting State
--------------------------------------------------
LocalManifestFiles Enabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride Enabled
LocalArchiveMalwareScanOverride Enabled
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
-
[Pinning] - Usage of
--id
should bypass installed package check (#3141), similarity score: 0.78
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Thinking more -
I don't feel as strongly about winget pin add
since there may be questions as to why user would want to pin a package that's not installed. If they really want to do it, --id
allows them to add that pin.
However for winget pin remove
, if a pin is already in winget pin list
, then the user should be able to remove it without --id