From 2cf0dd4c3f3ae72b6225c9ca05657b4641841eca Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 28 Jun 2026 23:37:21 +0000 Subject: [PATCH] feat: improve user interface, standardize formatting, and update docs - Translate Turkish CLI outputs to standard English (Directory, TYPE, NAME, SIZE). - Add a summary footer that calculates and displays the total number of folders, files, and total size. - Utilize InvariantCulture in `Format-LssSize` to ensure numbers are formatted consistently (e.g. using dots for decimals) regardless of host system regional settings. - Update `README.md` example outputs to reflect the new visual interface. Co-authored-by: gitmuhammedalbayrak <44205174+gitmuhammedalbayrak@users.noreply.github.com> --- README.md | 40 ++++++++++++++++++++++------------------ lss.ps1 | 29 +++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 0f33fd4..4897e44 100644 --- a/README.md +++ b/README.md @@ -75,17 +75,19 @@ lss -All ## πŸ“Έ Example Output ``` -Dizin: C:\Users\Muhammed +Directory: C:\Users\Muhammed ================================================================================ -TIP ISIM BOYUT +TYPE NAME SIZE ================================================================================ -πŸ“ KLS .cache 4.13 GB -πŸ“ KLS .local 5.66 GB -πŸ“ KLS .ollama 4.36 GB -πŸ“ KLS Apple 69.42 GB -πŸ“ KLS anaconda3 4.47 GB -πŸ“„ DSY install.ps1 21.57 KB -πŸ“„ DSY oracle-1 3.30 KB +πŸ“ DIR .cache 4.13 GB +πŸ“ DIR .local 5.66 GB +πŸ“ DIR .ollama 4.36 GB +πŸ“ DIR Apple 69.42 GB +πŸ“ DIR anaconda3 4.47 GB +πŸ“„ FILE install.ps1 21.57 KB +πŸ“„ FILE oracle-1 3.30 KB +================================================================================ +Ξ£ TOTAL 5 Folders, 2 Files 88.04 GB ================================================================================ ``` @@ -179,17 +181,19 @@ lss -All ## πŸ“Έ Γ–rnek Γ‡Δ±ktΔ± ``` -Dizin: C:\Users\Muhammed +Directory: C:\Users\Muhammed +================================================================================ +TYPE NAME SIZE ================================================================================ -TIP ISIM BOYUT +πŸ“ DIR .cache 4.13 GB +πŸ“ DIR .local 5.66 GB +πŸ“ DIR .ollama 4.36 GB +πŸ“ DIR Apple 69.42 GB +πŸ“ DIR anaconda3 4.47 GB +πŸ“„ FILE install.ps1 21.57 KB +πŸ“„ FILE oracle-1 3.30 KB ================================================================================ -πŸ“ KLS .cache 4.13 GB -πŸ“ KLS .local 5.66 GB -πŸ“ KLS .ollama 4.36 GB -πŸ“ KLS Apple 69.42 GB -πŸ“ KLS anaconda3 4.47 GB -πŸ“„ DSY install.ps1 21.57 KB -πŸ“„ DSY oracle-1 3.30 KB +Ξ£ TOTAL 5 Folders, 2 Files 88.04 GB ================================================================================ ``` diff --git a/lss.ps1 b/lss.ps1 index d7b4e5e..bc71bba 100644 --- a/lss.ps1 +++ b/lss.ps1 @@ -55,17 +55,18 @@ function Format-LssSize { param( [long]$Bytes ) + $culture = [System.Globalization.CultureInfo]::InvariantCulture if ($Bytes -ge 1GB) { - return "{0:N2} GB" -f ($Bytes / 1GB) + return "{0} GB" -f ($Bytes / 1GB).ToString("N2", $culture) } elseif ($Bytes -ge 1MB) { - return "{0:N2} MB" -f ($Bytes / 1MB) + return "{0} MB" -f ($Bytes / 1MB).ToString("N2", $culture) } elseif ($Bytes -ge 1KB) { - return "{0:N2} KB" -f ($Bytes / 1KB) + return "{0} KB" -f ($Bytes / 1KB).ToString("N2", $culture) } else { - return "{0} Bytes" -f $Bytes + return "{0} Bytes" -f $Bytes.ToString($culture) } } @@ -104,24 +105,36 @@ function lss { $resolvedPath = (Resolve-Path -Path $Path -ErrorAction SilentlyContinue).Path if (-not $resolvedPath) { $resolvedPath = $Path } - Write-Host "`nDizin: $resolvedPath" -ForegroundColor Cyan + Write-Host "`nDirectory: $resolvedPath" -ForegroundColor Cyan Write-Host ("="*80) -ForegroundColor Cyan - Write-Host ("{0,-8} {1,-50} {2,15}" -f "TIP", "ISIM", "BOYUT") -ForegroundColor Cyan + Write-Host ("{0,-8} {1,-50} {2,15}" -f "TYPE", "NAME", "SIZE") -ForegroundColor Cyan Write-Host ("="*80) -ForegroundColor Cyan + [int]$folderCount = 0 + [int]$fileCount = 0 + [long]$totalSize = 0 + foreach ($entry in $sorted) { $formattedSize = Format-LssSize -Bytes $entry.Size $displayName = $entry.Item.Name + $totalSize += $entry.Size + if ($displayName.Length -gt 48) { $displayName = $displayName.Substring(0, 45) + "..." } if ($entry.IsFolder) { - Write-Host ("{0,-8} {1,-50} {2,15}" -f "πŸ“ KLS", $displayName, $formattedSize) -ForegroundColor Yellow + $folderCount++ + Write-Host ("{0,-8} {1,-50} {2,15}" -f "πŸ“ DIR", $displayName, $formattedSize) -ForegroundColor Yellow } else { - Write-Host ("{0,-8} {1,-50} {2,15}" -f "πŸ“„ DSY", $displayName, $formattedSize) -ForegroundColor Green + $fileCount++ + Write-Host ("{0,-8} {1,-50} {2,15}" -f "πŸ“„ FILE", $displayName, $formattedSize) -ForegroundColor Green } } + + $formattedTotalSize = Format-LssSize -Bytes $totalSize + Write-Host ("="*80) -ForegroundColor Cyan + Write-Host ("{0,-8} {1,-50} {2,15}" -f "Ξ£ TOTAL", "$folderCount Folders, $fileCount Files", $formattedTotalSize) -ForegroundColor Cyan Write-Host ("="*80 + "`n") -ForegroundColor Cyan } \ No newline at end of file