Fix displayed app count in script output when removing apps

This commit is contained in:
Raphire
2025-09-28 18:21:14 +02:00
parent c52338648d
commit f1595cd91e

View File

@@ -826,7 +826,8 @@ function PrintFromFile {
function PrintAppsList {
param (
$path
$path,
$printCount = $false
)
if (-not (Test-Path $path)) {
@@ -834,6 +835,11 @@ function PrintAppsList {
}
$appsList = ReadAppslistFromFile $path
if ($printCount) {
Write-Output "- Remove $($appsList.Count) apps:"
}
Write-Host $appsList -ForegroundColor DarkGray
}
@@ -1572,7 +1578,7 @@ if ((-not $script:Params.Count) -or $RunDefaults -or $RunDefaultsLite -or $RunSa
PrintAppsList "$PSScriptRoot/Appslist.txt"
}
'2' {
AddParameter 'RemoveAppsCustom' 'Remove $($script:SelectedApps.Count) apps:' $false
AddParameter 'RemoveAppsCustom' "Remove $($script:SelectedApps.Count) apps:" $false
PrintAppsList "$PSScriptRoot/CustomAppsList"
}
}
@@ -1656,12 +1662,17 @@ if ((-not $script:Params.Count) -or $RunDefaults -or $RunDefaultsLite -or $RunSa
$parameterName = $line.Substring(0, $line.IndexOf('#'))
# Print parameter description and add parameter to Params list
if ($parameterName -eq "RemoveAppsCustom") {
PrintAppsList "$PSScriptRoot/CustomAppsList"
switch ($parameterName) {
'RemoveApps' {
PrintAppsList "$PSScriptRoot/Appslist.txt" $true
}
else {
'RemoveAppsCustom' {
PrintAppsList "$PSScriptRoot/CustomAppsList" $true
}
default {
Write-Output $line.Substring(($line.IndexOf('#') + 1), ($line.Length - $line.IndexOf('#') - 1))
}
}
if (-not $script:Params.ContainsKey($parameterName)) {
$script:Params.Add($parameterName, $true)