cmder/vendor/lib/lib_console.cmd
Dax T Games a5bdecca77 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_

![image](https://user-images.githubusercontent.com/7318053/47957637-052e3880-df90-11e8-93ef-91e1ab696d82.png)

Cuts ~2.4 seconds off of init time.

![image](https://user-images.githubusercontent.com/7318053/47957795-45db8100-df93-11e8-8ae0-551d12c4e2dc.png)
2018-11-04 01:36:51 +01:00

80 lines
1.6 KiB
Batchfile

@echo off
if "%fast_init%" == "1" exit /b
call "%~dp0lib_base.cmd"
set lib_console=call "%~dp0lib_console.cmd"
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (
call :%*
)
exit /b
:debug_output
:::===============================================================================
:::debug_output - Output a debug message to the console.
:::.
:::include:
:::.
::: call "lib_console.cmd"
:::.
:::usage:
:::.
::: %lib_console% debug_output [caller] [message]
:::.
:::required:
:::.
::: [caller] <in> Script/sub routine name calling debug_output
:::.
::: [message] <in> Message text to display.
:::.
:::-------------------------------------------------------------------------------
if %debug_output% gtr 0 echo DEBUG(%~1): %~2 & echo.
exit /b
:verbose_output
:::===============================================================================
:::verbose_output - Output a debug message to the console.
:::.
:::include:
:::.
::: call "$0"
:::.
:::usage:
:::.
::: %lib_console% verbose_output "[message]"
:::.
:::required:
:::.
::: [message] <in> Message text to display.
:::.
:::-------------------------------------------------------------------------------
if %verbose_output% gtr 0 echo %~1
exit /b
:show_error
:::===============================================================================
:::show_error - Output an error message to the console.
:::.
:::include:
:::.
::: call "$0"
:::.
:::usage:
:::.
::: %lib_console% show_error "[message]"
:::.
:::required:
:::.
::: [message] <in> Message text to display.
:::.
:::-------------------------------------------------------------------------------
echo ERROR: %~1
exit /b