You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.8 KiB
105 lines
3.8 KiB
# GoFaster 开发环境启动脚本 |
|
param( |
|
[switch]$Help |
|
) |
|
|
|
# 设置控制台编码 |
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 |
|
$OutputEncoding = [System.Text.Encoding]::UTF8 |
|
|
|
# 显示帮助信息 |
|
if ($Help) { |
|
Write-Host "使用方法:" -ForegroundColor Cyan |
|
Write-Host " .\start-dev.ps1 # 显示菜单" -ForegroundColor White |
|
Write-Host " .\start-dev.ps1 -Help # 显示此帮助" -ForegroundColor White |
|
Write-Host " .\dev-full.ps1 # 直接启动全栈" -ForegroundColor White |
|
Write-Host " .\dev-full.ps1 -Debug # 调试模式启动" -ForegroundColor White |
|
Write-Host " .\dev-full.ps1 -Watch # 监听模式启动" -ForegroundColor White |
|
exit 0 |
|
} |
|
|
|
# 显示启动菜单 |
|
function Show-Menu { |
|
Clear-Host |
|
Write-Host "========================================" -ForegroundColor Cyan |
|
Write-Host " GoFaster 开发环境启动菜单" -ForegroundColor Cyan |
|
Write-Host "========================================" -ForegroundColor Cyan |
|
Write-Host "" |
|
Write-Host "启动选项:" -ForegroundColor Yellow |
|
Write-Host " 1. 全栈启动 (前后端)" -ForegroundColor White |
|
Write-Host " 2. 全栈启动 (调试模式)" -ForegroundColor White |
|
Write-Host " 3. 全栈启动 (监听模式)" -ForegroundColor White |
|
Write-Host " 4. 仅启动后端" -ForegroundColor White |
|
Write-Host " 5. 仅启动前端" -ForegroundColor White |
|
Write-Host " 6. 退出" -ForegroundColor White |
|
Write-Host "" |
|
} |
|
|
|
# 主菜单循环 |
|
do { |
|
Show-Menu |
|
$choice = Read-Host "请选择 (1-6)" |
|
|
|
switch ($choice) { |
|
"1" { |
|
Write-Host "[INFO] 启动全栈开发环境..." -ForegroundColor Green |
|
try { |
|
& ".\dev-full.ps1" |
|
} catch { |
|
Write-Host "[ERROR] 启动失败: $($_.Exception.Message)" -ForegroundColor Red |
|
Read-Host "按回车键继续..." |
|
} |
|
} |
|
"2" { |
|
Write-Host "[INFO] 启动全栈开发环境 (调试模式)..." -ForegroundColor Green |
|
try { |
|
& ".\dev-full.ps1" -Debug |
|
} catch { |
|
Write-Host "[ERROR] 启动失败: $($_.Exception.Message)" -ForegroundColor Red |
|
Read-Host "按回车键继续..." |
|
} |
|
} |
|
"3" { |
|
Write-Host "[INFO] 启动全栈开发环境 (监听模式)..." -ForegroundColor Green |
|
try { |
|
& ".\dev-full.ps1" -Watch |
|
} catch { |
|
Write-Host "[ERROR] 启动失败: $($_.Exception.Message)" -ForegroundColor Red |
|
Read-Host "按回车键继续..." |
|
} |
|
} |
|
"4" { |
|
Write-Host "[INFO] 仅启动后端..." -ForegroundColor Green |
|
try { |
|
& ".\dev-full.ps1" -BackendOnly |
|
} catch { |
|
Write-Host "[ERROR] 启动失败: $($_.Exception.Message)" -ForegroundColor Red |
|
Read-Host "按回车键继续..." |
|
} |
|
} |
|
"5" { |
|
Write-Host "[INFO] 仅启动前端..." -ForegroundColor Green |
|
try { |
|
& ".\dev-full.ps1" -FrontendOnly |
|
} catch { |
|
Write-Host "[ERROR] 启动失败: $($_.Exception.Message)" -ForegroundColor Red |
|
Read-Host "按回车键继续..." |
|
} |
|
} |
|
"6" { |
|
Write-Host "[INFO] 再见!" -ForegroundColor Green |
|
exit 0 |
|
} |
|
default { |
|
Write-Host "[ERROR] 无效选择,请重新选择" -ForegroundColor Red |
|
Start-Sleep -Seconds 2 |
|
} |
|
} |
|
|
|
if ($choice -match "^[1-5]$") { |
|
$continue = Read-Host "是否返回主菜单? (y/n)" |
|
if ($continue -eq "n" -or $continue -eq "N") { |
|
break |
|
} |
|
} |
|
} while ($true)
|
|
|