-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall-DevelopingTodayScoopApps.ps1
More file actions
42 lines (35 loc) · 1.08 KB
/
Install-DevelopingTodayScoopApps.ps1
File metadata and controls
42 lines (35 loc) · 1.08 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
$apps = @(
"graph"
)
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) developing-today apps from scoop."
if ($apps.Count -eq 0) {
return
}
scoop install $($apps -join " ")
CheckLastExitCode