Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

24 rindas
886 B

  1. @echo off
  2. setlocal
  3. set "BasePath=./"
  4. REM 假设已经提供了文件名作为参数
  5. set "FileName=%~1"
  6. REM 将参数设置最终文件名
  7. set "FinalFile=%BasePath%src\implement\%FileName%_implement.go"
  8. REM 将文件名转换成大驼峰格式并设置成最终实现类名
  9. for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "ImplementName=%%i"
  10. REM 使用 PowerShell 替换接口名称,并指定 UTF-8 编码
  11. powershell -Command "(Get-Content '%BasePath%etc\template\template_implement.tpl') -replace 'DemoImplement', '%ImplementName%' | Out-File -FilePath '%BasePath%temp_implement.go' -Encoding UTF8"
  12. REM 如果需要,将临时文件重命名为最终文件(取决于move Y?N)
  13. move /Y "%BasePath%temp_implement.go" "%FinalFile%"
  14. echo Implement file %FileName%_dao.go generated successfully.
  15. endlocal