update nix_tools option to allow preferring nix tools

This commit is contained in:
Dax T. Games 2018-12-13 20:54:18 -05:00
commit 528a69dab9
2 changed files with 23 additions and 3 deletions

View File

@ -149,6 +149,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` | | `/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%` | | `/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 | | `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
| `/nix_tools [0-2]` | Define how `*nix` tools are added to the path. Prefer Windows Tools: 1, Prefer *nix Tools: 2, No `/usr/bin` in `%PATH%`: 0 | 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` | | `/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` | | `/user_aliases [file path]` | File path pointing to user aliases. | `%CMDER_ROOT%\config\user-aliases.cmd` |
| `/v` | Enables verbose output. | not set | | `/v` | Enables verbose output. | not set |

23
vendor/init.bat vendored
View File

@ -14,7 +14,8 @@ set debug_output=0
set time_init=0 set time_init=0
set fast_init=0 set fast_init=0
set max_depth=1 set max_depth=1
set prefer_windows_commands=1 :: Add *nix tools to end of path. 0 turns off *nix tools.
set nix_tools=1
set "CMDER_USER_FLAGS= " set "CMDER_USER_FLAGS= "
:: Find root dir :: Find root dir
@ -80,6 +81,20 @@ call "%cmder_root%\vendor\lib\lib_profile"
%lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!"
exit /b exit /b
) )
) else if /i "%1"=="/nix_tools" (
if "%2" equ "0" (
REM Do not add *nix tools to path
set nix_tools=0
shift
) else if "%2" equ "1" (
REM Add *nix tools to end of path
set nix_tools=1
shift
) else if "%2" equ "2" (
REM Add *nix tools to front of path
set nix_tools=2
shift
)
) else if /i "%1" == "/home" ( ) else if /i "%1" == "/home" (
if exist "%~2" ( if exist "%~2" (
set "HOME=%~2" set "HOME=%~2"
@ -237,7 +252,7 @@ goto :CONFIGURE_GIT
:: Add git to the path :: Add git to the path
if defined GIT_INSTALL_ROOT ( if defined GIT_INSTALL_ROOT (
rem add the unix commands at the end to not shadow windows commands like more rem add the unix commands at the end to not shadow windows commands like more
if "%prefer_windows_commands%" == "1" ( if %nix_tools% equ 1 (
%lib_console% debug_output init.bat "Preferring Windows commands" %lib_console% debug_output init.bat "Preferring Windows commands"
set "path_position=append" set "path_position=append"
) else ( ) else (
@ -251,7 +266,11 @@ if defined GIT_INSTALL_ROOT (
) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( ) else if exist "!GIT_INSTALL_ROOT!\mingw64" (
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position!
) )
if %nix_tools% geq 1 (
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position!
)
:: define SVN_SSH so we can use git svn with ssh svn repositories :: define SVN_SSH so we can use git svn with ssh svn repositories
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"