Files
rules/dev.bat
T
DarkiT 9a640012a6 init
2025-03-16 20:02:41 +08:00

66 lines
1.2 KiB
Batchfile

@echo off
chcp 65001 > nul
setlocal enabledelayedexpansion
REM 规则引擎开发环境脚本 - Windows版本
if "%~1"=="" goto help
if "%~1"=="start" goto start
if "%~1"=="clean" goto clean
goto help
:check_air
where air >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo 未检测到Air. 正在安装...
go install github.com/cosmtrek/air@latest
echo Air安装完成!
) else (
echo 检测到Air已安装.
)
goto :eof
:check_tmp_dir
if not exist "tmp" (
echo 创建tmp目录...
mkdir tmp
)
goto :eof
:start
call :check_air
call :check_tmp_dir
echo 启动规则引擎开发环境...
REM 设置Go代理
set "GOPROXY=https://goproxy.cn,direct"
echo 已设置GOPROXY=%GOPROXY%
REM 运行air
if exist ".air.toml" (
echo 使用.air.toml配置启动...
air
) else (
echo Error: .air.toml配置文件不存在。
exit /b 1
)
goto :eof
:clean
echo 清理临时文件...
if exist "tmp" (
rmdir /s /q tmp
echo tmp目录已清理
)
goto :eof
:help
echo 规则引擎开发环境工具 - Windows版本
echo.
echo 用法: %~n0 [命令]
echo.
echo 命令:
echo start 启动开发环境(使用Air热重载)
echo clean 清理临时文件
echo.
goto :eof