-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.ps1
More file actions
36 lines (30 loc) · 940 Bytes
/
uninstall.ps1
File metadata and controls
36 lines (30 loc) · 940 Bytes
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
#Requires -Version 5.1
[CmdletBinding()]
param(
[string]$InstallDir = "$env:USERPROFILE\.local\bin",
[switch]$Purge
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$BlExe = Join-Path $InstallDir 'bl.exe'
$ConfigDir = Join-Path $env:APPDATA 'bl'
if ($Purge) {
if (Test-Path $BlExe) {
Write-Host 'Removing credentials...'
try { & $BlExe auth logout --all 2>$null } catch { }
} else {
Write-Host "Warning: bl.exe not found at $BlExe; credentials were not removed automatically."
Write-Host "Run 'bl auth logout --all' from the original install location to clear credentials."
}
if (Test-Path $ConfigDir) {
Remove-Item -Recurse -Force $ConfigDir
Write-Host "Removed $ConfigDir"
}
}
if (Test-Path $BlExe) {
Remove-Item -Force $BlExe
Write-Host "Removed $BlExe"
} else {
Write-Host "bl.exe not found at $BlExe"
}
Write-Host 'Done.'