Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Show-WinGetPackage #5082

Closed
Gijsreyn opened this issue Dec 18, 2024 · 1 comment
Closed

Feature request: Show-WinGetPackage #5082

Gijsreyn opened this issue Dec 18, 2024 · 1 comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@Gijsreyn
Copy link
Contributor

Description of the new feature / enhancement

As a user, I want to have a command available to list the details of an installed package. This allows me to work with PowerShell objects and dependencies, as I'm not aware that when you uninstall a package, there is also a switch to remove its dependency.

Proposed technical implementation details

I just came up with a rough function created:

function Get-WinGetShowOutput
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string] $Id
    )

    $command = "winget show --id $Id"

    $result = Invoke-Expression -Command $command | Where-Object { $_ }

    $firstIndexPart = $result.IndexOf($result -match 'Found hub \[.+\]')
    $lastIndexPart = $result.Length - 1

    $content = ($result[$firstIndexPart..$lastIndexPart])

    $content = $content | ForEach-Object {
        if ($_ -match 'Found hub \[(.+?)\]')
        {
            $dynamicValue = $matches[1]
            $_ -replace "Found hub \[$dynamicValue\]", "Id: $dynamicValue"
        }
        else 
        {
            $_
        }
    }

    if (Get-Command -Name ConvertFrom-Yaml -ErrorAction SilentlyContinue)
    {
        $content = ConvertFrom-Yaml -InputObject $content
    }

    return $content
}

The output:

Image

@Gijsreyn Gijsreyn added the Issue-Feature This is a feature request for the Windows Package Manager client. label Dec 18, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Dec 18, 2024
@Gijsreyn
Copy link
Contributor Author

Sorry @denelon . I just noticed #3823. Closing this one.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage Issue need to be triaged label Dec 18, 2024
@denelon denelon added this to the 1.10 Client milestone Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests

2 participants