microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.99k stars 1.43k forks source link

PowerShell module commands missing Exact switch #3809

Open timconner opened 11 months ago

timconner commented 11 months ago

Brief description of your issue

When using the PowerShell module, the -Exact switch is missing / doesn't work. There is no tab completion for the switch and adding it to the command generates no errors or results.

Attempted to use multiple versions of the module and PowerShell hosts on multiple computers.

The equivalent command line commands work. (e.g. winget search --id Microsoft.WindowsTerminal --exact)

Microsoft.WindowsTerminal is only for demonstration purposes, the same result is produced reagardless of the package Id used.

Steps to reproduce

Start pwsh.exe

Install-Module -Name Microsoft.WinGet.Client
Find-WinGetPackage -Id Microsoft.WindowsTerminal -Exact

Expected behavior

I would expect the latest version of the package with the exact case sensitive name of Microsoft.WindowsTerminal to be returned.

Actual behavior

No output or errors.

Environment

OS: Windows 10 22H2 (Enterprise)

PowerShell Hosts:
PowerShell 7.3.8 (x64)
PowerShell 7.2.6 (x64)

Microsoft.WinGet.Client Module Versions:
0.2.2
0.2.1
0.2.0
Trenly commented 11 months ago

Have you tried using -MatchOption Equals? The syntax of the powershell cmdlets is not quite the same as the winget cli

PS> Find-WinGetPackage -?

NAME
    Find-WinGetPackage

SYNTAX
    Find-WinGetPackage [[-Query] <string[]>] [-Tag <string>] [-Command <string>] [-Count <uint>] [-Id <string>] [-Name
    <string>] [-Moniker <string>] [-Source <string>] [-MatchOption {Equals | EqualsCaseInsensitive |
    StartsWithCaseInsensitive | ContainsCaseInsensitive}] [<CommonParameters>]

ALIASES
    None

REMARKS
    None
timconner commented 11 months ago

Have you tried using -MatchOption Equals? The syntax of the powershell cmdlets is not quite the same as the winget cli

That works!

I was going off the examples in this repo like this one: https://github.com/microsoft/winget-cli/blob/190b81298eec67c993f62cb3c05bd5d13cb7e8b9/src/PowerShell/Microsoft.WinGet.Client/Examples/Sample_FindPackage.ps1#L28

Maybe it changed to MatchOption recently? My main issue is resolved with the MatchOption flag being pointed out, but maybe there is a documentation issue here?

denelon commented 11 months ago

@ryfu-msft can you take a look at the example?