mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-16 22:57:49 +08:00
CLink migration and clenaup
This commit is contained in:
50
vendor/init.bat
vendored
50
vendor/init.bat
vendored
@ -148,18 +148,39 @@ if "%CMDER_CLINK%" == "1" (
|
||||
|
||||
:: Run clink
|
||||
if defined CMDER_USER_CONFIG (
|
||||
if not exist "%CMDER_USER_CONFIG%\settings" (
|
||||
if not exist "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\clink_settings" (
|
||||
echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
|
||||
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings"
|
||||
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
|
||||
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\clink_settings"
|
||||
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.
|
||||
)
|
||||
|
||||
REM Cleanup lagacy Clink Settings file
|
||||
if exist "%CMDER_USER_CONFIG%\settings" if exist "%CMDER_USER_CONFIG%\clink_settings" (
|
||||
del "%CMDER_USER_CONFIG%\settings"
|
||||
)
|
||||
|
||||
REM Cleanup legacy CLink history file
|
||||
if exist "%CMDER_USER_CONFIG%\.history" if exist "%CMDER_USER_CONFIG%\clink_history" (
|
||||
del "%CMDER_USER_CONFIG%\.history"
|
||||
)
|
||||
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
|
||||
) else (
|
||||
if not exist "%CMDER_ROOT%\config\settings" (
|
||||
echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
|
||||
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings"
|
||||
if not exist "%CMDER_ROOT%\config\settings" if not exist "%CMDER_ROOT%\config\clink_settings" (
|
||||
echo Generating clink initial settings in "%CMDER_ROOT%\config\clink_settings"
|
||||
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\clink_settings"
|
||||
echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
|
||||
)
|
||||
|
||||
REM Cleanup lagacy Clink Settings file
|
||||
if exist "%CMDER_ROOT%\config\settings" if exist "%CMDER_ROOT%\config\clink_settings" (
|
||||
del "%CMDER_ROOT%\config\settings"
|
||||
)
|
||||
|
||||
REM Cleanup legacy Clink history file
|
||||
if exist "%CMDER_ROOT%\config\.history" if exist "%CMDER_ROOT%\config\clink_history" (
|
||||
del "%CMDER_ROOT%\config\.history"
|
||||
)
|
||||
|
||||
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
|
||||
)
|
||||
) else (
|
||||
@ -345,6 +366,13 @@ if "%CMDER_ALIASES%" == "1" (
|
||||
)
|
||||
|
||||
:: Add aliases to the environment
|
||||
type "%user_aliases%" | findstr /b /l /i "history=cat " >nul
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo Migrating alias 'history' to new Clink 1.x.x...
|
||||
call "%CMDER_ROOT%\vendor\bin\alias.cmd" /d history
|
||||
echo Restart the session to activate changes!
|
||||
)
|
||||
|
||||
call "%user_aliases%"
|
||||
|
||||
if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED
|
||||
@ -397,11 +425,11 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD
|
||||
echo * Search for 'user-aliases' and replace it with 'user_aliases'.
|
||||
)
|
||||
|
||||
alias history |find /i "cat" >nul
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo Migrating alias 'history' to new Clink 1.x.x...
|
||||
"%CMDER_ROOT%\vendor\bin\alias.cmd" history="^%%CMDER_ROOT^%%\vendor\clink\clink.bat" history
|
||||
)
|
||||
:: alias history |find /i "cat" >nul
|
||||
:: if "%ERRORLEVEL%" == "0" (
|
||||
:: echo Migrating alias 'history' to new Clink 1.x.x...
|
||||
:: "%CMDER_ROOT%\vendor\bin\alias.cmd" history="^%%CMDER_ROOT^%%\vendor\clink\clink.bat" history
|
||||
:: )
|
||||
|
||||
set initialConfig=
|
||||
|
||||
|
Reference in New Issue
Block a user