Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /f for fast init. #1942

Merged
merged 9 commits into from
Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,18 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/

##### Command Line Arguments for `init.bat`

| Argument | Description | Default |
| ----------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------- |
| `/c [user cmder root]` | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set |
| `/d` | Enables debug output. | not set |
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` |
| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` |
| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
| `/svn_ssh [path to ssh.exe]` | Define `%SVN_SSH%` so we can use git svn with ssh svn repositories. | `%GIT_INSTALL_ROOT%\bin\ssh.exe` |
| `/user_aliases [file path]` | File path pointing to user aliases. | `%CMDER_ROOT%\config\user-aliases.cmd` |
| `/v` | Enables verbose output. | not set |
| (custom arguments) | User defined arguments processed by `cexec`. Type `cexec /?` for more useage. | not set |
| Argument | Description | Default |
| ----------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------- |
| `/c [user cmder root]` | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set |
| `/d` | Enables debug output. | not set |
| `/f` | Enables Cmder Fast Init Mode. This disables some features, see pull request [#1492](https://github.com/cmderdev/cmder/pull/1942) for more details. | not set |
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` |
| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` |
| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
| `/svn_ssh [path to ssh.exe]` | Define `%SVN_SSH%` so we can use git svn with ssh svn repositories. | `%GIT_INSTALL_ROOT%\bin\ssh.exe` |
| `/user_aliases [file path]` | File path pointing to user aliases. | `%CMDER_ROOT%\config\user-aliases.cmd` |
| `/v` | Enables verbose output. | not set |
| (custom arguments) | User defined arguments processed by `cexec`. Type `cexec /?` for more useage. | not set |

### Cmder Shell User Config
Single user portable configuration is possible using the cmder specific shell config files. Edit the below files to add your own configuration:
Expand Down
11 changes: 9 additions & 2 deletions vendor/init.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set cmder_init_start=%time%
set verbose_output=0
set debug_output=0
set time_init=0
set fast_init=0
set max_depth=1
set "CMDER_USER_FLAGS= "

Expand Down Expand Up @@ -41,7 +42,9 @@ call "%cmder_root%\vendor\lib\lib_profile"
:var_loop
if "%~1" == "" (
goto :start
) else if /i "%1"=="/t" (
) else if /i "%1" == "/f" (
set fast_init=1
) else if /i "%1" == "/t" (
set time_init=1
) else if /i "%1"=="/v" (
set verbose_output=1
Expand Down Expand Up @@ -147,6 +150,11 @@ if not defined TERM set TERM=cygwin
setlocal enabledelayedexpansion
if defined GIT_INSTALL_ROOT (
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :SPECIFIED_GIT
) else if "%fast_init%" == "1" (
if exist "%CMDER_ROOT%\vendor\git-for-windows\cmd\git.exe" (
%lib_console% debug_output "Skipping Git Auto-Detect!"
goto :VENDORED_GIT
)
)

%lib_console% debug_output init.bat "Looking for Git install root..."
Expand Down Expand Up @@ -208,7 +216,6 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do (
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
%lib_console% debug_output "Using vendored Git from '!GIT_INSTALL_ROOT!..."
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd"
goto :CONFIGURE_GIT
) else (
goto :NO_GIT
Expand Down
2 changes: 1 addition & 1 deletion vendor/lib/lib_console.cmd
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 0 additions & 2 deletions vendor/lib/lib_git.cmd
Original file line number Diff line number Diff line change
@@ -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 "" (
Expand Down
17 changes: 16 additions & 1 deletion vendor/lib/lib_path.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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:\=\\%"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -115,7 +125,6 @@ exit /b
:::.
::: path <out> Sets the path env variable if required.
:::-------------------------------------------------------------------------------

setlocal enabledelayedexpansion
if "%~1" neq "" (
set "add_path=%~1"
Expand All @@ -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%"
Expand All @@ -155,5 +169,6 @@ exit /b
)
)

:end_enhance_path_recursive
endlocal & set "PATH=%PATH%"
exit /b
1 change: 0 additions & 1 deletion vendor/lib/lib_profile.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@echo off


call "%~dp0lib_base.cmd"
call "%%~dp0lib_console"
set lib_profile=call "%~dp0lib_profile.cmd"
Expand Down