diff options
| author | xq114 <[email protected]> | 2021-04-28 21:48:55 +0800 |
|---|---|---|
| committer | xq114 <[email protected]> | 2021-04-28 21:48:55 +0800 |
| commit | 5af95803a04619777fbe69e1193ed0978cb01550 (patch) | |
| tree | c01b7b537c7802de0ad8b03da23bd8bc136c2be1 /scripts | |
| parent | 9597a24c34cd2e47aab93c1a8a21914cff0c18a8 (diff) | |
improve environment management on cmd
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/xrepo.bat | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/scripts/xrepo.bat b/scripts/xrepo.bat index ff95b722a..a58f5ac02 100755 --- a/scripts/xrepo.bat +++ b/scripts/xrepo.bat @@ -1,2 +1,39 @@ -@echo off -xmake lua private.xrepo %* +@REM @echo off + +@set "XMAKE_EXE=%~dp0xmake.exe" +@if [%1]==[env] ( + if [%2]==[quit] ( + if defined XMAKE_PROMPT_BACKUP ( + call %XMAKE_ENV_BACKUP% + if %errorlevel% neq 0 exit /B %errorlevel% + set PROMPT=%XMAKE_PROMPT_BACKUP% + set XMAKE_ENV_BACKUP= + set XMAKE_PROMPT_BACKUP= + ) + goto :ENDXREPO + ) + if [%2]==[shell] ( + if defined XMAKE_PROMPT_BACKUP ( + call %XMAKE_ENV_BACKUP% + if %errorlevel% neq 0 exit /B %errorlevel% + set PROMPT=%XMAKE_PROMPT_BACKUP% + for /f %%i in ('%XMAKE_EXE% lua private.xrepo.action.env.info prompt') do @set "PROMPT=%%i %XMAKE_PROMPT_BACKUP%" + ) else ( + set XMAKE_PROMPT_BACKUP=%PROMPT% + for /f %%i in ('%XMAKE_EXE% lua private.xrepo.action.env.info prompt') do @set "PROMPT=%%i %PROMPT%" + ) + for /f %%i in ('%XMAKE_EXE% lua private.xrepo.action.env.info envfile') do @( + set "XMAKE_ENV_BACKUP=%%i.bat" + @"%XMAKE_EXE%" lua private.xrepo.action.env.info backup.cmd 1>"%%i.bat" + ) + for /f %%i in ('%XMAKE_EXE% lua private.xrepo.action.env.info envfile') do @( + @"%XMAKE_EXE%" lua private.xrepo.action.env.info script.cmd 1>"%%i.bat" + call "%%i.bat" + ) + goto :ENDXREPO + ) +) + +@call %XMAKE_EXE% lua private.xrepo %* + +:ENDXREPO |
