feat: merge install/uninstall into one interactive entrypoint

This commit is contained in:
2026-03-09 21:43:24 +08:00
parent 126b19dd7a
commit ff9383f597
4 changed files with 110 additions and 2 deletions

View File

@@ -28,6 +28,24 @@ header() {
header
echo -e "${BOLD}请选择操作:${NC}"
echo " 1) 安装 / 更新 OpenClaw"
echo " 2) 卸载 OpenClaw"
read -r -p "请输入选项 [1/2](默认 1: " ACTION
ACTION=${ACTION:-1}
if [[ "$ACTION" == "2" ]]; then
info "你选择了:卸载 OpenClaw"
if command -v openclaw &>/dev/null; then
openclaw uninstall --all --yes --non-interactive
else
warn "在 PATH 中未找到 openclaw尝试使用 npx 卸载..."
npx -y openclaw uninstall --all --yes --non-interactive
fi
success "OpenClaw 已卸载。"
exit 0
fi
# ─────────────────────────────────────────────
# 步骤 1: 检查 / 安装 Node 22+
# ─────────────────────────────────────────────