Files
winutil/functions/private/Get-WinUtilPackageLogSummary.ps1
727ba52a4d Deleted Test-WinUtilPackageManager.ps1 + custom winget and choco installs + remove winget/choco enums and exeptions (#4606)
* Update Invoke-WPFGetInstalled.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Delete functions/private/Test-WinUtilPackageManager.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Invoke-WPFGetInstalled.ps1

* Update Invoke-WPFGetInstalled.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilChoco.ps1

* Update Install-WinUtilWinget.ps1

* Fixed lastrun.json

* refactor: remove PackageManagers enum and unused custom exception classes

* Update Invoke-WPFUIElements.ps1

* Update Get-WinUtilSelectedPackages.ps1

* Update Set-Preferences.ps1

* Update main.ps1

* Complete package manager enum removal

Use string package-manager preferences throughout the remaining helpers and focused tests. Restore the existing Winget install flow and package-manager probe helper so PR 4606 keeps the current WinGet repair method.

* Fix string keyed package split

---------

Co-authored-by: Chris Titus <contact@christitus.com>
2026-07-02 12:50:57 -05:00

29 lines
1.0 KiB
PowerShell

function Get-WinUtilPackageLogSummary {
param(
[Parameter(Mandatory = $true)]
[object[]]$Packages,
[Parameter(Mandatory = $true)]
[string]$Preference
)
@($Packages | ForEach-Object {
$package = $_
$packageName = @($package.Name, $package.Description, $package.winget, $package.choco) |
Where-Object { -not [string]::IsNullOrWhiteSpace([string]$_) -and $_ -ne "na" } |
Select-Object -First 1
if ([string]::IsNullOrWhiteSpace([string]$packageName)) {
$packageName = "Unknown package"
}
if ($Preference -eq "Choco" -and -not [string]::IsNullOrWhiteSpace([string]$package.choco) -and $package.choco -ne "na") {
"$packageName (choco: $($package.choco))"
} elseif (-not [string]::IsNullOrWhiteSpace([string]$package.winget) -and $package.winget -ne "na") {
"$packageName (winget: $($package.winget))"
} else {
"$packageName (no package id)"
}
})
}