-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall-ScoopApps.ps1
More file actions
57 lines (48 loc) · 1.56 KB
/
Install-ScoopApps.ps1
File metadata and controls
57 lines (48 loc) · 1.56 KB
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
48
49
50
51
52
53
54
55
56
57
$apps = @(
# main
# "git", # built-in to scoop install script
# "pwsh", # built-in to scoop install script
"starship",
# extras
"autohotkey",
"vcredist2022",
"windows-terminal",
"wiztree"
# versions
"vscode-insiders"
)
Set-StrictMode -Version Latest
$PSNativeCommandUseErrorActionPreference = $true
if ($PSNativeCommandUseErrorActionPreference) {
# always true, this is a linter workaround
$ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
}
function CheckLastExitCode {
param ([int[]]$SuccessCodes = @(0))
if (!$?) {
if (-not (Test-Path variable://LastExitCode)) {
$LastExitCode = 1
Write-Verbose -Verbose "No LastExitCode found, setting to 1"
}
Write-Verbose -Verbose "Last CMD failed $LastExitCode"
exit
}
if (-not (Test-Path variable://LastExitCode)) {
Write-Verbose -Verbose "No LastExitCode found, setting to 0"
$LastExitCode = 0
}
if ($SuccessCodes -notcontains $LastExitCode) {
Write-Verbose -Verbose "EXE RETURNED EXIT CODE $LastExitCode"
exit
}
}
Write-Verbose -Verbose "Installing $($apps.Count) scoop apps from scoop."
if ($apps.Count -eq 0) {
return
}
scoop install $($apps -join " ")
CheckLastExitCode
# vscode-insiders
reg import (Join-Path (Join-Path (Get-Item (scoop which code-insiders)).Directory.FullName "..") "install-context.reg")
reg import (Join-Path (Join-Path (Get-Item (scoop which code-insiders)).Directory.FullName "..") "install-associations.reg")