-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.ps1
More file actions
67 lines (52 loc) · 2.42 KB
/
uninstall.ps1
File metadata and controls
67 lines (52 loc) · 2.42 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
58
59
60
61
62
63
64
65
66
67
# Firefly Framework CLI Uninstaller for Windows
# Usage: .\uninstall.ps1
$ErrorActionPreference = "Stop"
$Binary = "flywork"
function Write-Info($msg) { Write-Host " i $msg" -ForegroundColor Cyan }
function Write-Ok($msg) { Write-Host " ✓ $msg" -ForegroundColor Green }
function Write-Warn($msg) { Write-Host " ! $msg" -ForegroundColor Yellow }
Write-Host ""
Write-Info "Firefly Framework CLI Uninstaller"
Write-Host ""
# ── Remove binary ────────────────────────────────────────────────────────────
$InstallDir = Join-Path $env:LOCALAPPDATA "flywork\bin"
$BinPath = Join-Path $InstallDir "$Binary.exe"
if (Test-Path $BinPath) {
Remove-Item -Force $BinPath
Write-Ok "Removed $BinPath"
} else {
Write-Warn "Binary not found at $BinPath"
}
# Also check /usr/local/bin equivalent on Windows
$AltBin = Get-Command $Binary -ErrorAction SilentlyContinue
if ($AltBin) {
Remove-Item -Force $AltBin.Source -ErrorAction SilentlyContinue
Write-Ok "Removed $($AltBin.Source)"
}
# ── Remove ~/.flywork directory ──────────────────────────────────────────────
$FlyworkHome = Join-Path $env:USERPROFILE ".flywork"
if (Test-Path $FlyworkHome) {
$answer = Read-Host " ? Remove $FlyworkHome and all data? [y/N]"
if ($answer -eq "y" -or $answer -eq "Y") {
Remove-Item -Recurse -Force $FlyworkHome
Write-Ok "Removed $FlyworkHome"
} else {
Write-Info "Kept $FlyworkHome"
}
}
# ── Clean PATH ───────────────────────────────────────────────────────────────
$UserPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($UserPath -like "*$InstallDir*") {
$CleanPath = ($UserPath -split ";" | Where-Object { $_ -ne $InstallDir }) -join ";"
[System.Environment]::SetEnvironmentVariable("Path", $CleanPath, "User")
Write-Ok "Removed $InstallDir from user PATH"
}
# Remove empty install directory
if (Test-Path $InstallDir) {
$items = Get-ChildItem $InstallDir -ErrorAction SilentlyContinue
if (-not $items -or $items.Count -eq 0) {
Remove-Item -Force $InstallDir
}
}
Write-Host ""
Write-Ok "Flywork CLI uninstalled."