-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
31 lines (25 loc) · 1.04 KB
/
install.ps1
File metadata and controls
31 lines (25 loc) · 1.04 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
#Requires -Version 5.1
$ErrorActionPreference = 'Stop'
$Repo = "yutamago/ado-cli"
$BinName = "ado.exe"
$Binary = "ado-windows-x64.exe"
$InstallDir = if ($env:ADO_INSTALL_DIR) { $env:ADO_INSTALL_DIR } `
else { Join-Path $env:LOCALAPPDATA "ado" }
$DownloadUrl = "https://github.com/$Repo/releases/latest/download/$Binary"
Write-Host "Downloading ado CLI (windows/x64)..."
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
$Dest = Join-Path $InstallDir $BinName
Invoke-WebRequest -Uri $DownloadUrl -OutFile $Dest -UseBasicParsing
# Add to user PATH if not already present
$UserPath = [System.Environment]::GetEnvironmentVariable("PATH", "User")
if ($UserPath -notlike "*$InstallDir*") {
[System.Environment]::SetEnvironmentVariable(
"PATH",
"$InstallDir;$UserPath",
"User"
)
Write-Host "Added $InstallDir to your user PATH."
Write-Host "Restart your terminal for the PATH change to take effect."
}
Write-Host "Installed to $Dest"
Write-Host "Run 'ado --version' to verify the installation."