feat: confirm before installing in quick mode (irm | iex)

This commit is contained in:
i
2026-06-02 00:23:13 +08:00
parent be09e5b20c
commit 9539487f1c
+21
View File
@@ -1249,6 +1249,27 @@ function Run-QuickMode {
}
}
if (-not $Force -and -not $Upgrade) {
$action = if ($script:INSTALLED_VERSION) { "覆盖安装" } else { "安装" }
$srcLabel = switch ($script:SELECTED_SOURCE) {
"npm" { "npm registry" }
"github-official" { "GitHub (tiann/hapi)" }
"github-fork" { "GitHub (arkylin/Hapi-Docker)" }
}
Write-Host ""
Write-Host "即将${action} HAPI CLI:" -ForegroundColor White
Write-Host " 版本: v$($script:REMOTE_VERSION)" -ForegroundColor Cyan
Write-Host " 来源: $srcLabel" -ForegroundColor Cyan
Write-Host " 目录: $($script:INSTALL_DIR)" -ForegroundColor Cyan
Write-Host ""
$confirm = Read-Host "确认${action}? [Y/n]"
if ($confirm -match '^[Nn]') {
Write-Info "已取消"
exit 0
}
Write-Host ""
}
if ($script:SELECTED_SOURCE -eq "npm") {
Install-NodeJS -forSource "npm"
}