winget-cli
winget-cli copied to clipboard
Add an option to exclude a list of packages while exporting to a file
Description of the new feature/enhancement
At it's current state, winget exports "all" packages installed on the local system & the ones which are available on a remote source to a JSON file. And there's no way to control or fine-tune what get's included in the exported JSON file.
If I had installed a software earlier just to try it out, even that get's exported to the JSON file. So, I think it would be a nice feature to have if it was possible to control & fine-tune winget's export command.
Proposed technical implementation details (optional)
Add an optional flag to the export command which would accept a list of already installed packages to exclude from the JSON file.
Of course there could be a better way to deal with it & look forward to how things turn out to be with this feature.
I just found out about a blog on import/export by @weeyin83 that went live today. I thought I would share since this issue was recently created. Maybe it will help other users understand some of the more in-depth options.
- @denelon duplicate/related to https://github.com/microsoft/winget-cli/issues/1439
- https://github.com/microsoft/winget-cli/issues/2339
@vedantmgoyal2009 I don't think the tagged issue threads are duplicates of this one. Sure the ideas might share some similarities here & there but the core feature is miles apart. For more context, what I meant in this thread is to have a finer control on what gets included in the generated output of the winget export command.
For example, if I've the following set of software pre-installed:
- MS-Teams (should be exported)
- MS-Office (should NOT be exported)
- Visual Studio Code (should be exported)
I would like to export only MS-Teams & Visual Studio Code into the package.json file. I don't want/need MS-Office to exists in the JSON file.
On that note, I don't think there's any way to export only the necessary packages into the JSON file right now.
P.S: I have not worked on a Windows machine for months now so I can't verify the latest features winget was distributed with.
@Jarmos-san We've also had asks about having winget "ignore" packages for winget upgrade --all as well. If one were to winget exclude package that could function for both scenarios, but I'm not sure if that matches the behavior you are looking for here.
This ask seems more around winget export packages.json --exclude foo.foo. If the above were implemented, winget upgrade --all wouldn't upgrade "MS-Office", and it wouldn't export "MS-Office".
This ask seems more around winget export packages.json --exclude foo.foo. If the above were implemented, winget upgrade --all wouldn't upgrade "MS-Office", and it wouldn't export "MS-Office".
Indeed! That's what I had in mind as well.
Is this feature viable & is something your team has the resources to implement? If not then I guess winget exclude package works out well too.
I would love to experiment with the user-experience & provide more in-depth feedback but unfortunately, I don't have access to a Windows machine at the moment. So, I don't mind closing this issue as a duplicate(?)
The feature is viable, but it's lower priority than other work on the roadmap currently. We're looking at pinning before this.
[Policy] Command-Export