Skip to content

Instantly share code, notes, and snippets.

@chawyehsu
Created December 15, 2019 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chawyehsu/5c0d5a56486a985638a7cae15973d166 to your computer and use it in GitHub Desktop.
Save chawyehsu/5c0d5a56486a985638a7cae15973d166 to your computer and use it in GitHub Desktop.
diff --git a/libexec/scoop-list.ps1 b/libexec/scoop-list.ps1
index de366ddf..46e72894 100644
--- a/libexec/scoop-list.ps1
+++ b/libexec/scoop-list.ps1
@@ -18,32 +18,14 @@ $apps = @($local) + @($global)
if($apps) {
write-host "Installed apps$(if($query) { `" matching '$query'`"}): `n"
- $apps | Sort-Object { $_.name } | Where-Object { !$query -or ($_.name -match $query) } | ForEach-Object {
- $app = $_.name
- $global = $_.global
- $ver = current_version $app $global
-
- $install_info = install_info $app $ver $global
- write-host " $app " -NoNewline
- write-host -f DarkCyan $ver -NoNewline
-
- if($global) { write-host -f DarkGreen ' *global*' -NoNewline }
-
- if (!$install_info) { Write-Host ' *failed*' -ForegroundColor DarkRed -NoNewline }
- if ($install_info.hold) { Write-Host ' *hold*' -ForegroundColor DarkMagenta -NoNewline }
-
- if ($install_info.bucket -and ($install_info.bucket -ne 'main')) {
- write-host -f Yellow " [$($install_info.bucket)]" -NoNewline
- } elseif ($install_info.url) {
- write-host -f Yellow " [$($install_info.url)]" -NoNewline
- }
-
- if ($install_info.architecture -and $def_arch -ne $install_info.architecture) {
- write-host -f DarkRed " {$($install_info.architecture)}" -NoNewline
- }
- write-host ''
- }
- write-host ''
+ Write-Output (
+ $apps |
+ Sort-Object { $_.name } |
+ Where-Object { !$query -or ($_.name -match $query) } |
+ ForEach-Object { $_.name } |
+ Format-Wide { $_ } -AutoSize -Force |
+ Out-String
+ ).Trim()
exit 0
} else {
write-host "There aren't any apps installed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment