Skip to content

Commit 1a4120e

Browse files
Fix Sort-Object property expressions not being passed to the command; shorten verbose line exceeding 150 chars
1 parent 5183ed2 commit 1a4120e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/functions/public/Install-NerdFont.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,10 @@ Please run the command again with elevated rights (Run as Administrator) or prov
275275
# Nerd Fonts archives sometimes contain duplicate matching files in
276276
# compatibility subfolders. Keep a single file per filename.
277277
$remaining = @(Get-ChildItem -Path $extractPath -Recurse -File -Include '*.ttf', '*.otf')
278-
$preferred = $remaining | Sort-Object
279-
@{ Expression = { if ($_.FullName -match '(?i)[\\/]Windows Compatible[\\/]') { 1 } else { 0 } } },
278+
$preferred = $remaining | Sort-Object -Property @(
279+
@{ Expression = { if ($_.FullName -match '(?i)[\\/]Windows Compatible[\\/]') { 1 } else { 0 } } }
280280
@{ Expression = { $_.FullName.Length } }
281+
)
281282
$seenFileNames = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
282283
$duplicateRemoved = 0
283284
foreach ($file in $preferred) {
@@ -286,7 +287,7 @@ Please run the command again with elevated rights (Run as Administrator) or prov
286287
$duplicateRemoved++
287288
}
288289

289-
Write-Verbose "[$fontName] - Variant '$Variant' kept $($keep.Count) files, removed $removed and deduplicated $duplicateRemoved duplicates"
290+
Write-Verbose "[$fontName] - Variant '$Variant': kept $($keep.Count), removed $removed, deduplicated $duplicateRemoved"
290291
}
291292

292293
Write-Verbose "[$fontName] - Install to [$Scope]"

0 commit comments

Comments
 (0)