Skip to content

Add filter-by install scope (user/machine) for List and Search#6044

Open
IDisposable wants to merge 1 commit intomicrosoft:masterfrom
IDisposable:feature/more-filters
Open

Add filter-by install scope (user/machine) for List and Search#6044
IDisposable wants to merge 1 commit intomicrosoft:masterfrom
IDisposable:feature/more-filters

Conversation

@IDisposable
Copy link

@IDisposable IDisposable commented Feb 12, 2026

Fixes #6045 and Implements #4236 (summarized in #1155), #6046, and #6047

Microsoft Reviewers: Open in CodeFlow

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Also fix the filter-by source for List to work.
Added parameter to Get-WinGetPackage for install scope and
pass it down to the filters sent to WinGet CLI.
@IDisposable
Copy link
Author

Unrecognized words (1)

pagckages

Oops, fixed and force-pushed

@IDisposable IDisposable marked this pull request as ready for review February 12, 2026 06:55
@IDisposable IDisposable requested a review from a team as a code owner February 12, 2026 06:55
Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no actual change to behavior presented here (save potential improvements to completion). Filtering by scope is already present on list and adding it to search will require significant investment, including placing the scope into the index.

Filtering the list output based on the source parameter is achievable with a client only change, but this PR doesn't actually do what is needed.


## Bug Fixes

> 1. Prior to this version, it was permitted to provide a `--source` filter for the `winget list` command, however the parameter was ignored. Now if a filter is provided packages will be check before being returned from the `winget list` command.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> 1. Prior to this version, it was permitted to provide a `--source` filter for the `winget list` command, however the parameter was ignored. Now if a filter is provided packages will be check before being returned from the `winget list` command.
> 1. Prior to this version, it was permitted to provide a `--source` filter for the `winget list` command, however the parameter was used only to limit the sources to correlate with. Now, if a filter is provided, packages will be filtered before being output from the `winget list` command.

This is false; the parameter was used inconsistently from how it would seem most people expected (but very consistently with the rest of the command workflows).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When calling the Powershell API, it sure doesn't seem to filter by scope. My goal is to find all the user-scoped, winget-installed packages and reinstall them as machine-scoped if possible. Trying to script in Powershell...

Argument::ForType(Execution::Args::Type::Tag),
Argument::ForType(Execution::Args::Type::Command),
Argument::ForType(Execution::Args::Type::Source),
Argument{ Execution::Args::Type::InstallScope, Resource::String::InstalledScopeArgumentDescription, ArgumentType::Standard, Argument::Visibility::Help },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Argument{ Execution::Args::Type::InstallScope, Resource::String::InstalledScopeArgumentDescription, ArgumentType::Standard, Argument::Visibility::Help },
Argument{ Execution::Args::Type::InstallScope, Resource::String::InstallScopeDescription, ArgumentType::Standard, Argument::Visibility::Help },

Additionally, just accepting the parameter is unlikely to have the desired effect on the downstream workflow. search in particular intentionally avoids accessing the manifest, which is currently the only way to know available scopes and thus filter the results.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I was really only concerned with pulling a list to make an script to do an automated "user" to "machine" reinstall. I'll pull the search changes :)

}

Export-ModuleMember -Function Get-WinGetPackage No newline at end of file
Function Get-WinGetPackage{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not used; the PowerShell is all C# in \src\PowerShell.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like that should be removed then? Seems really confusing.


# New Feature: Filter List and Search command by install scope

This adds the ability to filter the list returned by the `winget list` and `winget search` commands by the install scope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list already accepted scope.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback Issue needs attention from issue or PR author Needs-Attention Issue needs attention from Microsoft and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Feb 13, 2026
@IDisposable
Copy link
Author

Filtering the list output based on the source parameter is achievable with a client only change, but this PR doesn't actually do what is needed.

What, beyond doing the same logic as the source is needed? https://github.com/microsoft/winget-cli/pull/6044/changes#diff-2cf6f75aa8aad569ed10c9f32e985e9348f431490438e7361d4a484c80050dceR66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs-Attention Issue needs attention from Microsoft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The filter parameter --source for winget list is ignored.

2 participants