mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-05-13 21:21:46 +00:00
35 lines
925 B
PowerShell
35 lines
925 B
PowerShell
# Usage: scoop list [query]
|
|
# Summary: List installed apps
|
|
# Help: Lists all installed apps, or the apps matching the supplied query.
|
|
param($query)
|
|
|
|
. "$psscriptroot\..\lib\core.ps1"
|
|
. "$psscriptroot\..\lib\versions.ps1"
|
|
. "$psscriptroot\..\lib\manifest.ps1"
|
|
. "$psscriptroot\..\lib\buckets.ps1"
|
|
|
|
reset_aliases
|
|
|
|
$local = installed_apps $false | % { @{ name = $_ } }
|
|
$global = installed_apps $true | % { @{ name = $_; global = $true } }
|
|
|
|
$apps = @($local) + @($global)
|
|
|
|
if($apps) {
|
|
echo "Installed apps$(if($query) { `" matching '$query'`"}):
|
|
"
|
|
$apps | sort { $_.name } | ? { !$query -or ($_.name -match $query) } | % {
|
|
$app = $_.name
|
|
$global = $_.global
|
|
$ver = current_version $app $global
|
|
$global_display = $null; if($global) { $global_display = '*global*'}
|
|
|
|
" $app ($ver) $global_display"
|
|
}
|
|
""
|
|
exit 0
|
|
} else {
|
|
"There aren't any apps installed."
|
|
exit 1
|
|
}
|