Skip to content

Commit 7cc8dab

Browse files
committed
🔧 [build] Refactor Build-ColorScriptCache function to improve result handling
- Adjusted logic to display summary only when not using PassThru - Moved result return statement to the end for clarity Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
1 parent 6e3ea69 commit 7cc8dab

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎ColorScripts-Enhanced/ColorScripts-Enhanced.psm1‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,13 +1401,8 @@ function Build-ColorScriptCache {
14011401

14021402
Write-Progress -Id 1 -Activity $progressActivity -Completed
14031403

1404-
# Return results if PassThru is specified
1405-
if ($PassThru) {
1406-
return [pscustomobject[]]$results
1407-
}
1408-
14091404
# Display summary if not using PassThru and there are results
1410-
if ($totalCount -gt 0) {
1405+
if (-not $PassThru -and $totalCount -gt 0) {
14111406
$summary = $results | Group-Object -Property Status | ForEach-Object {
14121407
[pscustomobject]@{
14131408
Status = $_.Name
@@ -1447,6 +1442,11 @@ function Build-ColorScriptCache {
14471442
Write-Host "`nTotal scripts processed: $totalCount" -ForegroundColor Cyan
14481443
Write-Host "Use -PassThru to see detailed results`n" -ForegroundColor Gray
14491444
}
1445+
1446+
# Return results if PassThru is specified
1447+
if ($PassThru) {
1448+
return [pscustomobject[]]$results
1449+
}
14501450
}
14511451
}
14521452

0 commit comments

Comments
 (0)