25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- @echo off
- setlocal
-
- set "BasePath=./"
-
- REM 假设已经提供了文件名作为参数
- set "FileName=%~1"
-
- REM 将参数设置最终文件名
- set "FinalFile=%BasePath%src\super\implement\%FileName%_db.go"
-
- REM 将文件名转换成大驼峰格式并设置成最终实现类名
- for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "ImplementName=%%i"
-
- REM 使用 PowerShell 替换接口名称,并指定 UTF-8 编码
- powershell -Command "(Get-Content '%BasePath%etc\template\template_implement.tpl') -replace 'DemoImplement', '%ImplementName%' | Out-File -FilePath '%BasePath%temp_implement.go' -Encoding UTF8"
-
- REM 如果需要,将临时文件重命名为最终文件(取决于move Y?N)
- move /Y "%BasePath%temp_implement.go" "%FinalFile%"
-
- echo Implement file %FileName%_dao.go generated successfully.
-
- endlocal
|