forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoop-list.ps1
47 lines (41 loc) · 1.49 KB
/
scoop-list.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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
$def_arch = default_architecture
$local = installed_apps $false | % { @{ name = $_ } }
$global = installed_apps $true | % { @{ name = $_; global = $true } }
$apps = @($local) + @($global)
if($apps) {
write-host "Installed apps$(if($query) { `" matching '$query'`"}): `n"
$apps | sort { $_.name } | ? { !$query -or ($_.name -match $query) } | % {
$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 DarkRed ' *global*' -NoNewline
}
if ($install_info.bucket) {
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 ''
exit 0
} else {
write-host "There aren't any apps installed."
exit 1
}