feat: merge install/uninstall into one interactive entrypoint
This commit is contained in:
@@ -20,6 +20,48 @@ try {
|
||||
|
||||
Write-Header
|
||||
|
||||
Write-Host "Choose an action:" -ForegroundColor White
|
||||
Write-Host " 1) Install / Update OpenClaw" -ForegroundColor Gray
|
||||
Write-Host " 2) Uninstall OpenClaw" -ForegroundColor Gray
|
||||
$action = Read-Host "Enter [1/2] (default: 1)"
|
||||
if ([string]::IsNullOrWhiteSpace($action)) { $action = "1" }
|
||||
|
||||
if ($action -eq "2") {
|
||||
Write-Info "You chose: uninstall OpenClaw"
|
||||
|
||||
$uninstalled = $false
|
||||
|
||||
if (Get-Command openclaw -ErrorAction SilentlyContinue) {
|
||||
try {
|
||||
openclaw uninstall --all --yes --non-interactive
|
||||
$uninstalled = $true
|
||||
} catch {
|
||||
Write-Warn "openclaw uninstall failed, trying npx..."
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $uninstalled -and (Get-Command npx -ErrorAction SilentlyContinue)) {
|
||||
try {
|
||||
npx -y openclaw uninstall --all --yes --non-interactive
|
||||
$uninstalled = $true
|
||||
} catch {
|
||||
Write-Warn "npx uninstall failed."
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Command npm -ErrorAction SilentlyContinue) {
|
||||
try { npm uninstall -g openclaw 2>$null | Out-Null } catch {}
|
||||
}
|
||||
|
||||
if ($uninstalled) {
|
||||
Write-Ok "OpenClaw uninstalled."
|
||||
} else {
|
||||
Write-Err "Failed to uninstall OpenClaw. Please ensure Node.js/npm is available and retry."
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# Step 1: Check / Install Node.js 22+
|
||||
# ─────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user