mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-31 09:22:15 +08:00 
			
		
		
		
	Add /f for fast init. (#1942)
The below enables Cmder Fast Init mode for `cmd.exe` sessions. This is more like the Cmder 1.3.5 init process. See issue #1821 Cmder Fast Init mode bypasses or disables the following Cmder 1.3.6+ features: * Git root and version detection. Defaults to `%cmder_root%\vendor\git-for-windows` if it exists. * Path enhance validation before path modify so `%Path%` enhancements are forced. * Recursive path add for `"%CMDER_ROOT%\bin"` * Recursive path add for `"%CMDER_USER_BIN%\bin"` if `/c [user_config_folder` is specified. * `/d` switch to enable debug output. * `/v` switch to enable debug output. Add `/f` to Cmder task as shown below t enable fast init: _Note 1: This setting is invalid in Cmder `Powershell` and `Bash` sessions~_ _Note 2: Add `/t` also to see init timer output_  Cuts ~2.4 seconds off of init time. 
This commit is contained in:
		
				
					committed by
					
						 Benjamin Staneck
						Benjamin Staneck
					
				
			
			
				
	
			
			
			
						parent
						
							5be25f29f8
						
					
				
				
					commit
					a5bdecca77
				
			
							
								
								
									
										2
									
								
								vendor/lib/lib_console.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/lib/lib_console.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| @echo off | ||||
|  | ||||
| rem set args=%* | ||||
| if "%fast_init%" == "1" exit /b | ||||
|  | ||||
| call "%~dp0lib_base.cmd" | ||||
| set lib_console=call "%~dp0lib_console.cmd" | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -1,11 +1,9 @@ | ||||
| @echo off | ||||
|  | ||||
|  | ||||
| call "%~dp0lib_base.cmd" | ||||
| call "%%~dp0lib_console.cmd" | ||||
| set lib_git=call "%~dp0lib_git.cmd" | ||||
|  | ||||
|  | ||||
| if "%~1" == "/h" ( | ||||
|     %lib_base% help "%~0" | ||||
| ) else if "%1" neq "" ( | ||||
|   | ||||
							
								
								
									
										17
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -52,6 +52,15 @@ exit /b | ||||
|         set "position=" | ||||
|     ) | ||||
|  | ||||
|     if "%fast_init%" == "1" ( | ||||
|       if "%position%" == "append" ( | ||||
|         set "PATH=%PATH%;%add_path%" | ||||
|       ) else ( | ||||
|         set "PATH=%add_path%;%PATH%" | ||||
|       ) | ||||
|       goto :end_enhance_path | ||||
|     ) | ||||
|  | ||||
|     set found=0 | ||||
|     set "find_query=%add_path%" | ||||
|     set "find_query=%find_query:\=\\%" | ||||
| @@ -85,6 +94,7 @@ exit /b | ||||
|         %lib_console% debug_output  :enhance_path "AFTER Env Var - PATH=!path!" | ||||
|     ) | ||||
|  | ||||
|     :end_enhance_path | ||||
|     endlocal & set "PATH=%PATH:;;=;%" | ||||
|     exit /b | ||||
|  | ||||
| @@ -115,7 +125,6 @@ exit /b | ||||
| :::. | ||||
| :::  path       <out> Sets the path env variable if required. | ||||
| :::------------------------------------------------------------------------------- | ||||
|  | ||||
|     setlocal enabledelayedexpansion | ||||
|     if "%~1" neq "" ( | ||||
|         set "add_path=%~1" | ||||
| @@ -136,6 +145,11 @@ exit /b | ||||
|         set "position=" | ||||
|     ) | ||||
|  | ||||
|     if "%fast_init%" == "1" ( | ||||
|       call :enhance_path "%add_path%" %position% | ||||
|       goto :end_enhance_path_recursive | ||||
|     ) | ||||
|  | ||||
|     if "%depth%" == "" set depth=0 | ||||
|  | ||||
|     %lib_console% debug_output  :enhance_path_recursive "Env Var - add_path=%add_path%" | ||||
| @@ -155,5 +169,6 @@ exit /b | ||||
|         ) | ||||
|     ) | ||||
|  | ||||
|     :end_enhance_path_recursive | ||||
|     endlocal & set "PATH=%PATH%" | ||||
|     exit /b | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/lib/lib_profile.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/lib/lib_profile.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,5 @@ | ||||
| @echo off | ||||
|  | ||||
|  | ||||
| call "%~dp0lib_base.cmd" | ||||
| call "%%~dp0lib_console" | ||||
| set lib_profile=call "%~dp0lib_profile.cmd" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user