mirror of
https://github.com/cmderdev/cmder.git
synced 2025-03-15 07:04:39 +08:00
add prompt for vanilla cmd.exe when clink not present
This commit is contained in:
parent
7c309c6a7b
commit
e3d9f81e25
38
vendor/init.bat
vendored
38
vendor/init.bat
vendored
@ -46,9 +46,9 @@ if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%"
|
|||||||
|
|
||||||
:: Include Cmder libraries
|
:: Include Cmder libraries
|
||||||
call "%cmder_root%\vendor\bin\cexec.cmd" /setpath
|
call "%cmder_root%\vendor\bin\cexec.cmd" /setpath
|
||||||
|
call "%cmder_root%\vendor\lib\lib_console"
|
||||||
call "%cmder_root%\vendor\lib\lib_base"
|
call "%cmder_root%\vendor\lib\lib_base"
|
||||||
call "%cmder_root%\vendor\lib\lib_path"
|
call "%cmder_root%\vendor\lib\lib_path"
|
||||||
call "%cmder_root%\vendor\lib\lib_console"
|
|
||||||
call "%cmder_root%\vendor\lib\lib_git"
|
call "%cmder_root%\vendor\lib\lib_git"
|
||||||
call "%cmder_root%\vendor\lib\lib_profile"
|
call "%cmder_root%\vendor\lib\lib_profile"
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ call "%cmder_root%\vendor\lib\lib_profile"
|
|||||||
set "GIT_INSTALL_ROOT=%~2"
|
set "GIT_INSTALL_ROOT=%~2"
|
||||||
shift
|
shift
|
||||||
) else (
|
) else (
|
||||||
%print_error% "The Git install root folder "%~2", you specified does not exist!"
|
%print_error% "The Git install root folder "%~2" that you specified does not exist!"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
) else if /i "%1" == "/nix_tools" (
|
) else if /i "%1" == "/nix_tools" (
|
||||||
@ -111,7 +111,7 @@ call "%cmder_root%\vendor\lib\lib_profile"
|
|||||||
set "HOME=%~2"
|
set "HOME=%~2"
|
||||||
shift
|
shift
|
||||||
) else (
|
) else (
|
||||||
%print_error% The home folder "%2", you specified does not exist!
|
%print_error% The home folder "%2" that you specified does not exist!
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
) else if /i "%1" == "/svn_ssh" (
|
) else if /i "%1" == "/svn_ssh" (
|
||||||
@ -124,6 +124,13 @@ call "%cmder_root%\vendor\lib\lib_profile"
|
|||||||
goto :var_loop
|
goto :var_loop
|
||||||
|
|
||||||
:start
|
:start
|
||||||
|
:: Enable console related methods if verbose/debug is turned on
|
||||||
|
if %debug_output% gtr 0 (set print_debug=%lib_console% debug_output)
|
||||||
|
if %verbose_output% gtr 0 (
|
||||||
|
set print_verbose=%lib_console% verbose_output
|
||||||
|
set print_warning=%lib_console% show_warning
|
||||||
|
)
|
||||||
|
|
||||||
:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES variables
|
:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES variables
|
||||||
%lib_base% cmder_shell
|
%lib_base% cmder_shell
|
||||||
%print_debug% init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
|
%print_debug% init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
|
||||||
@ -140,13 +147,22 @@ if defined CMDER_USER_CONFIG (
|
|||||||
set CMDER_CONFIG_DIR=%CMDER_USER_CONFIG%
|
set CMDER_CONFIG_DIR=%CMDER_USER_CONFIG%
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not "%CMDER_SHELL%" == "cmd" (
|
||||||
|
%print_warning% "Incompatible 'ComSpec/Shell' Detetected: %CMDER_SHELL%"
|
||||||
|
set CMDER_CLINK=0
|
||||||
|
set CMDER_ALIASES=0
|
||||||
|
)
|
||||||
|
|
||||||
:: Pick right version of Clink
|
:: Pick right version of Clink
|
||||||
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
|
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
|
||||||
set clink_architecture=x86
|
set clink_architecture=x86
|
||||||
set architecture_bits=32
|
set architecture_bits=32
|
||||||
) else (
|
) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
|
||||||
set clink_architecture=x64
|
set clink_architecture=x64
|
||||||
set architecture_bits=64
|
set architecture_bits=64
|
||||||
|
) else (
|
||||||
|
%print_warning% "Incompatible Processor Detetected: %PROCESSOR_ARCHITECTURE%"
|
||||||
|
set CMDER_CLINK=0
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%CMDER_CLINK%" == "1" (
|
if "%CMDER_CLINK%" == "1" (
|
||||||
@ -182,10 +198,18 @@ if "%CMDER_CLINK%" == "1" (
|
|||||||
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
|
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
|
||||||
|
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
%print_error% "Failed to initialize Clink with error code: %errorlevel%"
|
%print_error% "Clink initilization has failed with error code: %errorlevel%"
|
||||||
)
|
)
|
||||||
) else (
|
) else (
|
||||||
%print_verbose% "WARNING: Incompatible 'ComSpec/Shell' Detetected, Skipping Clink Injection!"
|
%print_warning% "Skipping Clink Injection!"
|
||||||
|
|
||||||
|
for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x
|
||||||
|
chcp 65001>nul
|
||||||
|
|
||||||
|
:: Revert back to plain cmd.exe prompt without clink
|
||||||
|
prompt $E[1;32;49m$P$S$_$E[1;30;49mλ$S$E[0m
|
||||||
|
|
||||||
|
chcp %cp%>nul
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%CMDER_CONFIGURED%" GTR "1" (
|
if "%CMDER_CONFIGURED%" GTR "1" (
|
||||||
@ -265,7 +289,7 @@ goto :CONFIGURE_GIT
|
|||||||
:: Add git to the path
|
:: Add git to the path
|
||||||
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" ""
|
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" ""
|
||||||
|
|
||||||
:: Add the unix commands at the end to not shadow windows commands like more and find
|
:: Add the unix commands at the end to not shadow windows commands like `more` and `find`
|
||||||
if %nix_tools% equ 1 (
|
if %nix_tools% equ 1 (
|
||||||
%print_verbose% "Preferring Windows commands"
|
%print_verbose% "Preferring Windows commands"
|
||||||
set "path_position=append"
|
set "path_position=append"
|
||||||
|
4
vendor/lib/lib_base.cmd
vendored
4
vendor/lib/lib_base.cmd
vendored
@ -68,13 +68,9 @@ exit /b
|
|||||||
set CMDER_SHELL=%~n1
|
set CMDER_SHELL=%~n1
|
||||||
if not defined CMDER_CLINK (
|
if not defined CMDER_CLINK (
|
||||||
set CMDER_CLINK=1
|
set CMDER_CLINK=1
|
||||||
if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0
|
|
||||||
if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0
|
|
||||||
)
|
)
|
||||||
if not defined CMDER_ALIASES (
|
if not defined CMDER_ALIASES (
|
||||||
set CMDER_ALIASES=1
|
set CMDER_ALIASES=1
|
||||||
if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0
|
|
||||||
if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0
|
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
24
vendor/lib/lib_console.cmd
vendored
24
vendor/lib/lib_console.cmd
vendored
@ -7,9 +7,10 @@ set ESC=
|
|||||||
:: Much faster than using "%lib_console% debug_output ..." etc.
|
:: Much faster than using "%lib_console% debug_output ..." etc.
|
||||||
set print_debug=if %debug_output% gtr 0 %lib_console% debug_output
|
set print_debug=if %debug_output% gtr 0 %lib_console% debug_output
|
||||||
set print_verbose=if %verbose_output% gtr 0 %lib_console% verbose_output
|
set print_verbose=if %verbose_output% gtr 0 %lib_console% verbose_output
|
||||||
|
set print_warning=if %verbose_output% gtr 0 %lib_console% show_warning
|
||||||
set print_error=%lib_console% show_error
|
set print_error=%lib_console% show_error
|
||||||
|
|
||||||
if "%fast_init%" == "1" exit /b
|
if %fast_init% gtr %verbose_output% if %fast_init% gtr %debug_output% exit /b
|
||||||
|
|
||||||
if "%~1" == "/h" (
|
if "%~1" == "/h" (
|
||||||
%lib_base% help "%~0"
|
%lib_base% help "%~0"
|
||||||
@ -83,3 +84,24 @@ exit /b
|
|||||||
|
|
||||||
echo %ESC%[91;1mERROR:%ESC%[0m %~1
|
echo %ESC%[91;1mERROR:%ESC%[0m %~1
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
:show_warning
|
||||||
|
:::===============================================================================
|
||||||
|
:::show_warning - Output a warning message to the console.
|
||||||
|
:::.
|
||||||
|
:::include:
|
||||||
|
:::.
|
||||||
|
::: call "$0"
|
||||||
|
:::.
|
||||||
|
:::usage:
|
||||||
|
:::.
|
||||||
|
::: %lib_console% show_warning "[message]"
|
||||||
|
:::.
|
||||||
|
:::required:
|
||||||
|
:::.
|
||||||
|
::: [message] <in> Message text to display.
|
||||||
|
:::.
|
||||||
|
:::-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
echo %ESC%[93;1mWARNING:%ESC%[0m %~1
|
||||||
|
exit /b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user