Skip to content

Commit 439851c

Browse files
committed
update install_cli.ps1
1 parent 341af6d commit 439851c

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

bin/install_cli.ps1

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
$ErrorActionPreference = "Stop"
22

3-
# Configuration
43
$Repo = "MichaelCurrin/auto-commit-msg"
54
$Binaries = @("acm", "gacm", "auto_commit_msg")
65
$InstallDir = "$HOME\AppData\Local\bin"
76

8-
$ReleasesApiUrl = "https://api.github.com/repos/$Repo/releases"
9-
$LatestRelease = Invoke-RestMethod -Uri $ReleasesApiUrl -UseBasicParsing | Select-Object -First 1
10-
if (-not $LatestRelease -or -not $LatestRelease.tag_name) {
11-
throw "Could not determine latest release tag from $ReleasesApiUrl"
12-
}
13-
14-
$Tag = $LatestRelease.tag_name
15-
Write-Host "Found latest tag: '$Tag'."
16-
$RepoUrl = "https://github.com/$Repo/releases/download/$Tag"
7+
$RepoUrl = "https://github.com/$Repo/releases/latest/download"
178

18-
# Ensure install directory exists
9+
# Ensure install directory exists.
1910
if (!(Test-Path $InstallDir)) {
2011
New-Item -ItemType Directory -Path $InstallDir | Out-Null
2112
}
2213

23-
# Create a temporary workspace
14+
# Create a temporary workspace.
2415
$TempDir = Join-Path $env:TEMP ([Guid]::NewGuid().ToString())
2516
New-Item -ItemType Directory -Path $TempDir | Out-Null
2617

@@ -40,7 +31,7 @@ try {
4031
Move-Item -Path $TempPath -Destination $DestPath -Force
4132
}
4233

43-
# Verify PATH
34+
# Verify PATH.
4435
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
4536
if ($UserPath -notlike "*$InstallDir*") {
4637
Write-Host "Adding $InstallDir to User PATH..." -ForegroundColor Cyan
@@ -52,7 +43,7 @@ try {
5243
Write-Host "Please restart your terminal to refresh the PATH." -ForegroundColor Yellow
5344
}
5445
finally {
55-
# Cleanup
46+
# Cleanup.
5647
if (Test-Path $TempDir) {
5748
Remove-Item -Path $TempDir -Recurse -Force
5849
}

0 commit comments

Comments
 (0)