feat: prompt for modules in bat launcher

This commit is contained in:
DESKTOP-I3JPKHK\wy 2026-04-21 16:53:10 +08:00
parent 354c28f178
commit 486cea9913
2 changed files with 38 additions and 3 deletions

View File

@ -403,13 +403,30 @@ sync: {
## Windows 双击运行 ## Windows 双击运行
`init` 会同时创建 `run-yx-generate-api.bat`。它会先切到脚本所在目录,再执行: `init` 会同时创建 `run-yx-generate-api.bat`
它支持两种使用方式:
- 直接双击运行
会先提示你输入模块名或额外参数;留空则执行全量生成。
- 在命令行里带参数运行
会直接把参数透传给 `yx-generate-api gen`
它内部的核心行为相当于:
```bat ```bat
npx yx-generate-api gen %* npx yx-generate-api gen %*
``` ```
适合给不常开命令行的同事直接双击执行。 双击时可输入的内容示例:
```bat
Curriculum
Ranking EnglishWord
--modules=Ranking,EnglishWord
```
适合给不常开命令行的同事直接双击执行,也保留了命令行传参的灵活性。
也可以在命令行里继续传参: 也可以在命令行里继续传参:

View File

@ -4,7 +4,25 @@ setlocal
cd /d "%~dp0" cd /d "%~dp0"
if errorlevel 1 goto :cd_error if errorlevel 1 goto :cd_error
call npx yx-generate-api gen %* set "RUN_ARGS=%*"
if not "%~1"=="" goto :run
echo.
echo 请输入要执行的模块名或额外参数。
echo 示例:
echo Curriculum
echo Ranking EnglishWord
echo --modules=Ranking,EnglishWord
echo 直接回车则执行全量生成。
set /p RUN_ARGS=模块/参数:
:run
if defined RUN_ARGS (
call npx yx-generate-api gen %RUN_ARGS%
) else (
call npx yx-generate-api gen
)
if errorlevel 1 goto :run_error if errorlevel 1 goto :run_error
exit /b 0 exit /b 0