mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 19:32:13 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/more_speed_2' into more_speed_2
This commit is contained in:
		@@ -60,7 +60,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
 | 
			
		||||
| `/SINGLE`                 | Start Cmder in single mode.                                                              |
 | 
			
		||||
| `/START [start_path]`     | Folder path to start in.                                                                 |
 | 
			
		||||
| `/TASK [task_name]`       | Task to start after launch.                                                              |
 | 
			
		||||
| `/X [ConEmu extras pars]` | Forwards parameters to ConEmu                                                            |
 | 
			
		||||
| `-- [ConEmu extras pars]` | Forwards ALL remaining parameters to ConEmu.                                             |
 | 
			
		||||
 | 
			
		||||
## Context Menu Integration
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ STRINGTABLE
 | 
			
		||||
{
 | 
			
		||||
	IDS_TITLE             "Cmder Launcher"
 | 
			
		||||
 | 
			
		||||
	IDS_SWITCHES          L"Valid options:\n\n    /c [CMDER User Root Path]\n    /task [ConEmu Task Name]\n    /icon [CMDER Icon Path]\n    [/start [Start in Path] | [Start in Path]]\n    /single\n    /m\n    /x [ConEmu extra arguments]\n\nor, either:\n    /register [USER | ALL]\n    /unregister [USER | ALL]"
 | 
			
		||||
	IDS_SWITCHES          L"Valid options:\n\n    /c [CMDER User Root Path]\n    /task [ConEmu Task Name]\n    /icon [CMDER Icon Path]\n    [/start [Start in Path] | [Start in Path]]\n    /single\n    /m\n    -- [ConEmu extra arguments]\n\nNote: '-- [...]' must be the last argument!\n\nor, either:\n    /register [USER | ALL]\n    /unregister [USER | ALL]"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/bin/create-cmdercfg.ps1
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/bin/create-cmdercfg.ps1
									
									
									
									
										vendored
									
									
								
							@@ -11,7 +11,7 @@ $CmderFunctions  = Join-Path $CmderModulePath "Cmder.ps1"
 | 
			
		||||
 | 
			
		||||
if ($shell -match 'cmd') {
 | 
			
		||||
  write-host "Generating Cmder Config for '$shell' shell in '$outfile'..."
 | 
			
		||||
  templateExpand "$env:cmder_root\vendor\user_init.cmd.template" "$outfile"
 | 
			
		||||
  templateExpand "$env:cmder_root\vendor\user_init.template.cmd" "$outfile"
 | 
			
		||||
} elseif ($shell -match 'powershell') {
 | 
			
		||||
  write-host "'$shell' is not supported at this time!"
 | 
			
		||||
} elseif ($shell -match 'bash') {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								vendor/bin/timer.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								vendor/bin/timer.cmd
									
									
									
									
										vendored
									
									
								
							@@ -11,6 +11,7 @@ set /a hours=%end_h%-%start_h%
 | 
			
		||||
set /a mins=%end_m%-%start_m%
 | 
			
		||||
set /a secs=%end_s%-%start_s%
 | 
			
		||||
set /a ms=%end_ms%-%start_ms%
 | 
			
		||||
 | 
			
		||||
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
 | 
			
		||||
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
 | 
			
		||||
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
 | 
			
		||||
@@ -20,3 +21,26 @@ if 1%ms% lss 100 set ms=0%ms%
 | 
			
		||||
:: Mission accomplished
 | 
			
		||||
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
 | 
			
		||||
echo Elapsed Time: %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total)
 | 
			
		||||
 | 
			
		||||
:: cleanup
 | 
			
		||||
set start=
 | 
			
		||||
set end=
 | 
			
		||||
set options=
 | 
			
		||||
 | 
			
		||||
set start_h=
 | 
			
		||||
set start_m=
 | 
			
		||||
set start_s=
 | 
			
		||||
set start_ms=
 | 
			
		||||
 | 
			
		||||
set end_h=
 | 
			
		||||
set end_m=
 | 
			
		||||
set end_s=
 | 
			
		||||
set end_ms=
 | 
			
		||||
 | 
			
		||||
set hours=
 | 
			
		||||
set mins=
 | 
			
		||||
set secs=
 | 
			
		||||
set ms=
 | 
			
		||||
 | 
			
		||||
set totalsecs=
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							@@ -551,7 +551,7 @@ if defined CMDER_USER_CONFIG (
 | 
			
		||||
    %print_error% "Failed to generate Cmder config"
 | 
			
		||||
  )
 | 
			
		||||
) else if not exist "%CMDER_ROOT%\config\user_init.cmd" (
 | 
			
		||||
  powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd"
 | 
			
		||||
  powershell -executionpolicy bypass -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd -outfile "%CMDER_ROOT%\config\user_init.cmd"
 | 
			
		||||
 | 
			
		||||
  if not exist "%CMDER_ROOT%\config\user_init.cmd" (
 | 
			
		||||
    %print_error% "Failed to generate Cmder config"
 | 
			
		||||
@@ -559,10 +559,31 @@ if defined CMDER_USER_CONFIG (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
:CMDER_CONFIGURED
 | 
			
		||||
if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
 | 
			
		||||
  if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
 | 
			
		||||
  set CMDER_INIT_END=%time%
 | 
			
		||||
 | 
			
		||||
set CMDER_INIT_END=%time%
 | 
			
		||||
  if "%time_init%" == "1" if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" (
 | 
			
		||||
    call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
:CLEANUP
 | 
			
		||||
  set architecture_bits=
 | 
			
		||||
  set CMDER_ALIASES=
 | 
			
		||||
  set CMDER_INIT_END=
 | 
			
		||||
  set CMDER_INIT_START=
 | 
			
		||||
  set CMDER_USER_FLAGS=
 | 
			
		||||
  set CMDER_CLINK=
 | 
			
		||||
  set debug_output=
 | 
			
		||||
  set fast_init=
 | 
			
		||||
  set max_depth=
 | 
			
		||||
  set nix_tools=
 | 
			
		||||
  set path_position=
 | 
			
		||||
  set print_debug=
 | 
			
		||||
  set print_error=
 | 
			
		||||
  set print_verbose=
 | 
			
		||||
  set print_warning=
 | 
			
		||||
  set time_init=
 | 
			
		||||
  set verbose_output=
 | 
			
		||||
  set user_aliases=
 | 
			
		||||
 | 
			
		||||
    "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
 | 
			
		||||
)
 | 
			
		||||
exit /b
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										168
									
								
								vendor/user_init.cmd.template
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										168
									
								
								vendor/user_init.cmd.template
									
									
									
									
										vendored
									
									
								
							@@ -1,168 +0,0 @@
 | 
			
		||||
@echo off
 | 
			
		||||
 | 
			
		||||
:: This file was autogenerated by Cmder init.bat
 | 
			
		||||
::
 | 
			
		||||
:: It is yours to edit and will not be touched again by Cmder.
 | 
			
		||||
::
 | 
			
		||||
:: If you wish to recreate this file simply rename it and Cmder will re-create it the next time it is run
 | 
			
		||||
:: or run the followin command from a Cmder shell:
 | 
			
		||||
::
 | 
			
		||||
:: powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd [-outfile "[filename]"]
 | 
			
		||||
::
 | 
			
		||||
 | 
			
		||||
if "%CMDER_CLINK%" == "1" (
 | 
			
		||||
  goto :INJECT_CLINK
 | 
			
		||||
) else if "%CMDER_CLINK%" == "2" (
 | 
			
		||||
  goto :CLINK_FINISH
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
goto :SKIP_CLINK
 | 
			
		||||
 | 
			
		||||
:INJECT_CLINK
 | 
			
		||||
  %print_verbose% "Injecting Clink!"
 | 
			
		||||
 | 
			
		||||
  :: Check if Clink is not present
 | 
			
		||||
  if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" (
 | 
			
		||||
      goto :SKIP_CLINK
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  :: Run Clink
 | 
			
		||||
  if not exist "%CMDER_CONFIG_DIR%\settings" if not exist "%CMDER_CONFIG_DIR%\clink_settings" (
 | 
			
		||||
      echo Generating Clink initial settings in "%CMDER_CONFIG_DIR%\clink_settings"
 | 
			
		||||
      copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_CONFIG_DIR%\clink_settings"
 | 
			
		||||
      echo Additional *.lua files in "%CMDER_CONFIG_DIR%" are loaded on startup.
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  if not exist "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" (
 | 
			
		||||
      echo Creating Cmder prompt config file: "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
 | 
			
		||||
      copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
 | 
			
		||||
 | 
			
		||||
  if errorlevel 1 (
 | 
			
		||||
      %print_error% "Clink initialization has failed with error code: %errorlevel%"
 | 
			
		||||
      goto :CLINK_FINISH
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  set CMDER_CLINK=2
 | 
			
		||||
  goto :CLINK_FINISH
 | 
			
		||||
 | 
			
		||||
:SKIP_CLINK
 | 
			
		||||
  %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
 | 
			
		||||
:CLINK_FINISH
 | 
			
		||||
 | 
			
		||||
if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=$env:GIT_INSTALL_ROOT"
 | 
			
		||||
if not defined SVN_SSH          set "SVN_SSH=$env:SVN_SSH"
 | 
			
		||||
if not defined git_locale       set git_locale=$env:git_locale
 | 
			
		||||
if not defined LANG             set LANG=$env:lang
 | 
			
		||||
if not defined user_aliases     set "user_aliases=$env:user_aliases"
 | 
			
		||||
if not defined aliases          set "aliases=%user_aliases%"
 | 
			
		||||
if not defined HOME             set "HOME=%USERPROFILE%"
 | 
			
		||||
 | 
			
		||||
set PLINK_PROTOCOL=$env:PLINK_PROTOCOL
 | 
			
		||||
 | 
			
		||||
set "path=%GIT_INSTALL_ROOT%\cmd;%path%"
 | 
			
		||||
 | 
			
		||||
set path_position=append
 | 
			
		||||
if %nix_tools% equ 1 (
 | 
			
		||||
    set "path_position=append"
 | 
			
		||||
) else (
 | 
			
		||||
    set "path_position="
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if %nix_tools% geq 1 (
 | 
			
		||||
    if exist "%GIT_INSTALL_ROOT%\mingw32" (
 | 
			
		||||
        if "%path_position%" == "append" (
 | 
			
		||||
          set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin"
 | 
			
		||||
        ) else (
 | 
			
		||||
          set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%"
 | 
			
		||||
        )
 | 
			
		||||
    ) else if exist "%GIT_INSTALL_ROOT%\mingw64" (
 | 
			
		||||
        if "%path_position%" == "append" (
 | 
			
		||||
          set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin"
 | 
			
		||||
        ) else (
 | 
			
		||||
          set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%"
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
    if exist "%GIT_INSTALL_ROOT%\usr\bin" (
 | 
			
		||||
        if "%path_position%" == "append" (
 | 
			
		||||
          set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin"
 | 
			
		||||
        ) else (
 | 
			
		||||
          set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%"
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set "path=%CMDER_ROOT%\vendor\bin;%path%"
 | 
			
		||||
 | 
			
		||||
:USER_CONFIG_START
 | 
			
		||||
if %max_depth% gtr 1 (
 | 
			
		||||
  %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
 | 
			
		||||
) else (
 | 
			
		||||
  set "path=%CMDER_ROOT%\bin;%path%"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
setlocal enabledelayedexpansion
 | 
			
		||||
if defined CMDER_USER_BIN (
 | 
			
		||||
  if %max_depth% gtr 1 (
 | 
			
		||||
    %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
 | 
			
		||||
  ) else (
 | 
			
		||||
    set "path=%CMDER_USER_ROOT%\bin;%path%"
 | 
			
		||||
  )
 | 
			
		||||
)
 | 
			
		||||
endlocal && set "path=%path%"
 | 
			
		||||
 
 | 
			
		||||
set "path=%path%;%CMDER_ROOT%"
 | 
			
		||||
 | 
			
		||||
call "%user_aliases%"
 | 
			
		||||
 | 
			
		||||
%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d"
 | 
			
		||||
if defined CMDER_USER_CONFIG (
 | 
			
		||||
  %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
call "%CMDER_ROOT%\config\user_profile.cmd"
 | 
			
		||||
if defined CMDER_USER_CONFIG (
 | 
			
		||||
  if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
 | 
			
		||||
    call "%CMDER_USER_CONFIG%\user_profile.cmd"
 | 
			
		||||
  )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set "path=%path:;;=;%
 | 
			
		||||
 | 
			
		||||
:CMDER_CONFIGURED
 | 
			
		||||
if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
 | 
			
		||||
 | 
			
		||||
set CMDER_INIT_END=%time%
 | 
			
		||||
 | 
			
		||||
if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" (
 | 
			
		||||
  "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
:: Cleanup
 | 
			
		||||
set architecture_bits=""
 | 
			
		||||
set CMDER_ALIASES=""
 | 
			
		||||
set CMDER_INIT_END=""
 | 
			
		||||
set CMDER_INIT_START=""
 | 
			
		||||
set debug_output=""
 | 
			
		||||
set fast_init=""
 | 
			
		||||
set max_depth=""
 | 
			
		||||
set nix_tools=""
 | 
			
		||||
set path_position=""
 | 
			
		||||
set print_debug=""
 | 
			
		||||
set print_error=""
 | 
			
		||||
set print_verbose=""
 | 
			
		||||
set print_warning=""
 | 
			
		||||
set time_init=""
 | 
			
		||||
set verbose_output=""
 | 
			
		||||
 | 
			
		||||
exit /b
 | 
			
		||||
							
								
								
									
										160
									
								
								vendor/user_init.optional.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										160
									
								
								vendor/user_init.optional.cmd
									
									
									
									
										vendored
									
									
								
							@@ -1,160 +0,0 @@
 | 
			
		||||
@echo off
 | 
			
		||||
 | 
			
		||||
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 | 
			
		||||
:: WARNING: THIS IS UNSUPORTED CODE USE IT IF YOU WANT. SEE BELOW FOR DETAILS!
 | 
			
		||||
:: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 | 
			
		||||
::
 | 
			
		||||
:: If you use this file you will be using an unsupported option you assume all
 | 
			
		||||
:: and responsibility for troubleshooting any issues!
 | 
			
		||||
::
 | 
			
		||||
:: ## What is this?
 | 
			
		||||
::
 | 
			
		||||
:: This file initializes the Cmder `cmd.exe` shell with hard coded settings so it is much
 | 
			
		||||
:: faster at loading the session config since it does not have to auto discover anything.
 | 
			
		||||
::
 | 
			
		||||
:: If you want complete control and responsibility of your Cmder setup copy this file to
 | 
			
		||||
:: `%CMDER_ROOT%\config\user_init.cmd` and edit to customize your setup your way.
 | 
			
		||||
::
 | 
			
		||||
:: ## Shared Cmder Installs
 | 
			
		||||
::
 | 
			
		||||
:: If using in a shared Cmder install copy to `%CMDER_ROOT%\config\user_init.cmd` or
 | 
			
		||||
:: `%CMDER_USER_ROOT%\config\user_init.cmd` whichever acieves the goal of the shared
 | 
			
		||||
:: install.
 | 
			
		||||
::
 | 
			
		||||
 | 
			
		||||
if "%CMDER_CLINK%" == "1" (
 | 
			
		||||
  goto :INJECT_CLINK
 | 
			
		||||
) else if "%CMDER_CLINK%" == "2" (
 | 
			
		||||
  goto :CLINK_FINISH
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
goto :SKIP_CLINK
 | 
			
		||||
 | 
			
		||||
:INJECT_CLINK
 | 
			
		||||
  %print_verbose% "Injecting Clink!"
 | 
			
		||||
 | 
			
		||||
  :: Check if Clink is not present
 | 
			
		||||
  if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" (
 | 
			
		||||
      goto :SKIP_CLINK
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  :: Run Clink
 | 
			
		||||
  if not exist "%CMDER_CONFIG_DIR%\settings" if not exist "%CMDER_CONFIG_DIR%\clink_settings" (
 | 
			
		||||
      echo Generating Clink initial settings in "%CMDER_CONFIG_DIR%\clink_settings"
 | 
			
		||||
      copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_CONFIG_DIR%\clink_settings"
 | 
			
		||||
      echo Additional *.lua files in "%CMDER_CONFIG_DIR%" are loaded on startup.
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  if not exist "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" (
 | 
			
		||||
      echo Creating Cmder prompt config file: "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
 | 
			
		||||
      copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
 | 
			
		||||
 | 
			
		||||
  if errorlevel 1 (
 | 
			
		||||
      %print_error% "Clink initialization has failed with error code: %errorlevel%"
 | 
			
		||||
      goto :CLINK_FINISH
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  set CMDER_CLINK=2
 | 
			
		||||
  goto :CLINK_FINISH
 | 
			
		||||
 | 
			
		||||
:SKIP_CLINK
 | 
			
		||||
  %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
 | 
			
		||||
:CLINK_FINISH
 | 
			
		||||
 | 
			
		||||
if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
 | 
			
		||||
if not defined SVN_SSH          set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
 | 
			
		||||
if not defined git_locale       set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe"
 | 
			
		||||
if not defined LANG             set LANG=en_US.UTF-8
 | 
			
		||||
if not defined user_aliases     set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd"
 | 
			
		||||
if not defined aliases          set "aliases=%user_aliases%"
 | 
			
		||||
if not defined HOME             set "HOME=%USERPROFILE%"
 | 
			
		||||
 | 
			
		||||
set PLINK_PROTOCOL=ssh
 | 
			
		||||
 | 
			
		||||
set "path=%GIT_INSTALL_ROOT%\cmd;%path%"
 | 
			
		||||
 | 
			
		||||
set path_position=append
 | 
			
		||||
if %nix_tools% equ 1 (
 | 
			
		||||
    set "path_position=append"
 | 
			
		||||
) else (
 | 
			
		||||
    set "path_position="
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if %nix_tools% geq 1 (
 | 
			
		||||
    if exist "%GIT_INSTALL_ROOT%\mingw32" (
 | 
			
		||||
        if "%path_position%" == "append" (
 | 
			
		||||
          set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin"
 | 
			
		||||
        ) else (
 | 
			
		||||
          set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%"
 | 
			
		||||
        )
 | 
			
		||||
    ) else if exist "%GIT_INSTALL_ROOT%\mingw64" (
 | 
			
		||||
        if "%path_position%" == "append" (
 | 
			
		||||
          set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin"
 | 
			
		||||
        ) else (
 | 
			
		||||
          set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%"
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
    if exist "%GIT_INSTALL_ROOT%\usr\bin" (
 | 
			
		||||
        if "%path_position%" == "append" (
 | 
			
		||||
          set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin"
 | 
			
		||||
        ) else (
 | 
			
		||||
          set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%"
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set "path=%CMDER_ROOT%\vendor\bin;%path%"
 | 
			
		||||
 | 
			
		||||
:USER_CONFIG_START
 | 
			
		||||
if %max_depth% gtr 1 (
 | 
			
		||||
  %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
 | 
			
		||||
) else (
 | 
			
		||||
  set "path=%CMDER_ROOT%\bin;%path%"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
setlocal enabledelayedexpansion
 | 
			
		||||
if defined CMDER_USER_BIN (
 | 
			
		||||
  if %max_depth% gtr 1 (
 | 
			
		||||
    %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
 | 
			
		||||
  ) else (
 | 
			
		||||
    set "path=%CMDER_USER_ROOT%\bin;%path%"
 | 
			
		||||
  )
 | 
			
		||||
)
 | 
			
		||||
endlocal && set "path=%path%"
 | 
			
		||||
 
 | 
			
		||||
set "path=%path%;%CMDER_ROOT%"
 | 
			
		||||
 | 
			
		||||
call "%user_aliases%"
 | 
			
		||||
 | 
			
		||||
%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d"
 | 
			
		||||
if defined CMDER_USER_CONFIG (
 | 
			
		||||
  %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
call "%CMDER_ROOT%\config\user_profile.cmd"
 | 
			
		||||
if defined CMDER_USER_CONFIG (
 | 
			
		||||
  if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
 | 
			
		||||
    call "%CMDER_USER_CONFIG%\user_profile.cmd"
 | 
			
		||||
  )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set "path=%path:;;=;%
 | 
			
		||||
 | 
			
		||||
:CMDER_CONFIGURED
 | 
			
		||||
if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
 | 
			
		||||
 | 
			
		||||
set CMDER_INIT_END=%time%
 | 
			
		||||
 | 
			
		||||
"%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
 | 
			
		||||
exit /b
 | 
			
		||||
							
								
								
									
										172
									
								
								vendor/user_init.template.cmd
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								vendor/user_init.template.cmd
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,172 @@
 | 
			
		||||
@echo off
 | 
			
		||||
 | 
			
		||||
:: This file was autogenerated by Cmder init.bat
 | 
			
		||||
::
 | 
			
		||||
:: It is yours to edit and will not be touched again by Cmder.
 | 
			
		||||
::
 | 
			
		||||
:: If you wish to recreate this file simply rename it and Cmder will re-create it the next time it is run
 | 
			
		||||
:: or run the followin command from a Cmder shell:
 | 
			
		||||
::
 | 
			
		||||
:: powershell -f %cmder_root%\vendor\bin\create-cmdercfg.ps1 -shell cmd [-outfile "[filename]"]
 | 
			
		||||
::
 | 
			
		||||
 | 
			
		||||
if "%CMDER_CLINK%" == "1" (
 | 
			
		||||
  goto :INJECT_CLINK
 | 
			
		||||
) else if "%CMDER_CLINK%" == "2" (
 | 
			
		||||
  goto :CLINK_FINISH
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
goto :SKIP_CLINK
 | 
			
		||||
 | 
			
		||||
:INJECT_CLINK
 | 
			
		||||
  %print_verbose% "Injecting Clink!"
 | 
			
		||||
 | 
			
		||||
  :: Check if Clink is not present
 | 
			
		||||
  if not exist "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" (
 | 
			
		||||
      goto :SKIP_CLINK
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  :: Run Clink
 | 
			
		||||
  if not exist "%CMDER_CONFIG_DIR%\settings" if not exist "%CMDER_CONFIG_DIR%\clink_settings" (
 | 
			
		||||
      echo Generating Clink initial settings in "%CMDER_CONFIG_DIR%\clink_settings"
 | 
			
		||||
      copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_CONFIG_DIR%\clink_settings"
 | 
			
		||||
      echo Additional *.lua files in "%CMDER_CONFIG_DIR%" are loaded on startup.
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  if not exist "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua" (
 | 
			
		||||
      echo Creating Cmder prompt config file: "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
 | 
			
		||||
      copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_CONFIG_DIR%\cmder_prompt_config.lua"
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_CONFIG_DIR%" --scripts "%CMDER_ROOT%\vendor"
 | 
			
		||||
 | 
			
		||||
  if errorlevel 1 (
 | 
			
		||||
      %print_error% "Clink initialization has failed with error code: %errorlevel%"
 | 
			
		||||
      goto :CLINK_FINISH
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  set CMDER_CLINK=2
 | 
			
		||||
  goto :CLINK_FINISH
 | 
			
		||||
 | 
			
		||||
:SKIP_CLINK
 | 
			
		||||
  %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
 | 
			
		||||
 | 
			
		||||
:CLINK_FINISH
 | 
			
		||||
  if not defined GIT_INSTALL_ROOT set "GIT_INSTALL_ROOT=$env:GIT_INSTALL_ROOT"
 | 
			
		||||
  if not defined SVN_SSH          set "SVN_SSH=$env:SVN_SSH"
 | 
			
		||||
  if not defined git_locale       set git_locale=$env:git_locale
 | 
			
		||||
  if not defined LANG             set LANG=$env:lang
 | 
			
		||||
  if not defined user_aliases     set "user_aliases=$env:user_aliases"
 | 
			
		||||
  if not defined aliases          set "aliases=%user_aliases%"
 | 
			
		||||
  if not defined HOME             set "HOME=%USERPROFILE%"
 | 
			
		||||
  
 | 
			
		||||
  set PLINK_PROTOCOL=$env:PLINK_PROTOCOL
 | 
			
		||||
  
 | 
			
		||||
  set "path=%GIT_INSTALL_ROOT%\cmd;%path%"
 | 
			
		||||
  
 | 
			
		||||
  set path_position=append
 | 
			
		||||
  if %nix_tools% equ 1 (
 | 
			
		||||
      set "path_position=append"
 | 
			
		||||
  ) else (
 | 
			
		||||
      set "path_position="
 | 
			
		||||
  )
 | 
			
		||||
  
 | 
			
		||||
  if %nix_tools% geq 1 (
 | 
			
		||||
      if exist "%GIT_INSTALL_ROOT%\mingw32" (
 | 
			
		||||
          if "%path_position%" == "append" (
 | 
			
		||||
            set "path=%path%;%GIT_INSTALL_ROOT%\mingw32\bin"
 | 
			
		||||
          ) else (
 | 
			
		||||
            set "path=%GIT_INSTALL_ROOT%\mingw32\bin;%path%"
 | 
			
		||||
          )
 | 
			
		||||
      ) else if exist "%GIT_INSTALL_ROOT%\mingw64" (
 | 
			
		||||
          if "%path_position%" == "append" (
 | 
			
		||||
            set "path=%path%;%GIT_INSTALL_ROOT%\mingw64\bin"
 | 
			
		||||
          ) else (
 | 
			
		||||
            set "path=%GIT_INSTALL_ROOT%\mingw64\bin;%path%"
 | 
			
		||||
          )
 | 
			
		||||
      )
 | 
			
		||||
      if exist "%GIT_INSTALL_ROOT%\usr\bin" (
 | 
			
		||||
          if "%path_position%" == "append" (
 | 
			
		||||
            set "path=%path%;%GIT_INSTALL_ROOT%\usr\bin"
 | 
			
		||||
          ) else (
 | 
			
		||||
            set "path=%GIT_INSTALL_ROOT%\usr\bin;%path%"
 | 
			
		||||
          )
 | 
			
		||||
      )
 | 
			
		||||
  )
 | 
			
		||||
  
 | 
			
		||||
  set "path=%CMDER_ROOT%\vendor\bin;%path%"
 | 
			
		||||
 | 
			
		||||
:USER_CONFIG_START
 | 
			
		||||
  if %max_depth% gtr 1 (
 | 
			
		||||
    %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth%
 | 
			
		||||
  ) else (
 | 
			
		||||
    set "path=%CMDER_ROOT%\bin;%path%"
 | 
			
		||||
  )
 | 
			
		||||
  
 | 
			
		||||
  setlocal enabledelayedexpansion
 | 
			
		||||
  if defined CMDER_USER_BIN (
 | 
			
		||||
    if %max_depth% gtr 1 (
 | 
			
		||||
      %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth%
 | 
			
		||||
    ) else (
 | 
			
		||||
      set "path=%CMDER_USER_ROOT%\bin;%path%"
 | 
			
		||||
    )
 | 
			
		||||
  )
 | 
			
		||||
  endlocal && set "path=%path%"
 | 
			
		||||
   
 | 
			
		||||
  set "path=%path%;%CMDER_ROOT%"
 | 
			
		||||
  
 | 
			
		||||
  call "%user_aliases%"
 | 
			
		||||
  
 | 
			
		||||
  %lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d"
 | 
			
		||||
  if defined CMDER_USER_CONFIG (
 | 
			
		||||
    %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
 | 
			
		||||
  )
 | 
			
		||||
  
 | 
			
		||||
  call "%CMDER_ROOT%\config\user_profile.cmd"
 | 
			
		||||
  if defined CMDER_USER_CONFIG (
 | 
			
		||||
    if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
 | 
			
		||||
      call "%CMDER_USER_CONFIG%\user_profile.cmd"
 | 
			
		||||
    )
 | 
			
		||||
  )
 | 
			
		||||
  
 | 
			
		||||
  set "path=%path:;;=;%
 | 
			
		||||
 | 
			
		||||
:CMDER_CONFIGURED
 | 
			
		||||
  if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
 | 
			
		||||
  
 | 
			
		||||
  set CMDER_INIT_END=%time%
 | 
			
		||||
  
 | 
			
		||||
  if "%time_init%" == "1" if "%CMDER_INIT_END%" neq "" if "%CMDER_INIT_START%" neq "" (
 | 
			
		||||
    call "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
:CLEANUP
 | 
			
		||||
  set architecture_bits=
 | 
			
		||||
  set CMDER_ALIASES=
 | 
			
		||||
  set CMDER_INIT_END=
 | 
			
		||||
  set CMDER_INIT_START=
 | 
			
		||||
  set CMDER_USER_FLAGS=
 | 
			
		||||
  set debug_output=
 | 
			
		||||
  set fast_init=
 | 
			
		||||
  set max_depth=
 | 
			
		||||
  set nix_tools=
 | 
			
		||||
  set path_position=
 | 
			
		||||
  set print_debug=
 | 
			
		||||
  set print_error=
 | 
			
		||||
  set print_verbose=
 | 
			
		||||
  set print_warning=
 | 
			
		||||
  set time_init=
 | 
			
		||||
  set verbose_output=
 | 
			
		||||
  set user_aliases=
 | 
			
		||||
 | 
			
		||||
exit /b
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user