diff --git a/vendor/clink.lua b/vendor/clink.lua index 2074664..0b2c6be 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -368,26 +368,12 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do end end -local cmder_config_dir = clink.get_env('CMDER_ROOT')..'/config/' -for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do - -- Skip files that starts with _. This could be useful if some files should be ignored - if not string.match(lua_module, '^_.*') then - local filename = cmder_config_dir..lua_module - -- use dofile instead of require because require caches loaded modules - -- so config reloading using Alt-Q won't reload updated modules. - dofile(filename) - end -end - if clink.get_env('CMDER_USER_CONFIG') then - local cmder_user_config_dir = clink.get_env('CMDER_USER_CONFIG')..'/' - for _,lua_module in ipairs(clink.find_files(cmder_user_config_dir..'*.lua')) do - -- Skip files that starts with _. This could be useful if some files should be ignored - if not string.match(lua_module, '^_.*') then - local filename = cmder_user_config_dir..lua_module - -- use dofile instead of require because require caches loaded modules - -- so config reloading using Alt-Q won't reload updated modules. - dofile(filename) - end + local cmder_config_dir = clink.get_env('CMDER_ROOT')..'/config/' + for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do + local filename = cmder_config_dir..lua_module + -- use dofile instead of require because require caches loaded modules + -- so config reloading using Alt-Q won't reload updated modules. + dofile(filename) end end diff --git a/vendor/init.bat b/vendor/init.bat index a689bde..a745914 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -7,6 +7,7 @@ :: !!! Use "%CMDER_ROOT%\config\user_profile.cmd" to add your own startup commands :: Use /v command line arg or set to > 0 for verbose output to aid in debugging. +endlocal set verbose_output=0 set debug_output=0 set max_depth=1 @@ -137,14 +138,14 @@ if not defined TERM set TERM=cygwin :: also check that we have a recent enough version of git by examining the version string setlocal enabledelayedexpansion if defined GIT_INSTALL_ROOT ( - if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :FOUND_GIT + if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :SPECIFIED_GIT ) %lib_console% debug_output init.bat "Looking for Git install root..." :: get the version information for vendored git binary %lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd" -%lib_git% validate_version VENDORED !GIT_VERSION_VENDORED! +%lib_git% validate_version VENDORED %GIT_VERSION_VENDORED% :: check if git is in path... for /F "delims=" %%F in ('where git.exe 2^>nul') do ( @@ -189,12 +190,22 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :VENDORED_GIT 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 ) +:SPECIFIED_GIT +%lib_console% debug_output "Using /GIT_INSTALL_ROOT from '%GIT_INSTALL_ROOT%..." +goto :CONFIGURE_GIT + :FOUND_GIT +%lib_console% debug_output "Using found Git from '%GIT_INSTALL_ROOT%..." +goto :CONFIGURE_GIT + +:CONFIGURE_GIT :: Add git to the path if defined GIT_INSTALL_ROOT ( rem add the unix commands at the end to not shadow windows commands like more @@ -326,12 +337,12 @@ if not exist "%initialConfig%" ( echo Creating user startup file: "%initialConfig%" ( echo :: use this file to run your own startup commands -echo :: use in front of the command to prevent printing the command +echo :: use in front of the command to prevent printing the command echo. echo :: uncomment this to have the ssh agent load when cmder starts echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd" echo. -echo :: uncomment this next two lines to use pageant as the ssh authentication agent +echo :: uncomment the next two lines to use pageant as the ssh authentication agent echo :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-pageant.cmd" echo. @@ -356,5 +367,6 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD ) set initialConfig= +set CMDER_CONFIGURED=1 exit /b diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index fc040f0..2e7f60e 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -53,8 +53,8 @@ exit /b :: get the git version in the provided directory for /F "tokens=1,2,3 usebackq" %%A in (`"%git_executable%" --version 2^>nul`) do ( if /i "%%A %%B" == "git version" ( - set "GIT_VERSION_%~1=%%C" - %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%%C" + set "GIT_VERSION=%%C" + %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=!GIT_VERSION!" ) else ( %lib_console% show_error "git --version" returned an inproper version string! pause @@ -62,7 +62,7 @@ exit /b ) ) - endlocal & set GIT_VERSION%~1=!GIT_VERSION%~1! + endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%" exit /b :parse_version @@ -92,6 +92,7 @@ exit /b setlocal enabledelayedexpansion :: process a `x.x.x.xxxx.x` formatted string + %lib_console% debug_output :parse_version "ARGV[1]=%~1, ARGV[2]=%~2" for /F "tokens=1-3* delims=.,-" %%A in ("%2") do ( set "%~1_MAJOR=%%A" set "%~1_MINOR=%%B" @@ -121,6 +122,7 @@ exit /b :::------------------------------------------------------------------------------- :: now parse the version information into the corresponding variables + %lib_console% debug_output :validate_version "ARGV[1]=%~1, ARGV[2]=%~2" call :parse_version %~1 %~2 :: ... and maybe display it, for debugging purposes. @@ -148,9 +150,9 @@ exit /b :: checks all major, minor, patch and build variables for the given arguments. :: whichever binary that has the most recent version will be used based on the return code. - :: %lib_console% debug_output Comparing: - :: %lib_console% debug_output %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD! - :: %lib_console% debug_output %~2: !%~2_MAJOR!.!%~2_MINOR!.!%~2_PATCH!.!%~2_BUILD! + %lib_console% debug_output Comparing: + %lib_console% debug_output %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD! + %lib_console% debug_output %~2: !%~2_MAJOR!.!%~2_MINOR!.!%~2_PATCH!.!%~2_BUILD! if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1) if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 0b478d4..d59c44d 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -52,19 +52,23 @@ exit /b set "position=" ) + set found=0 set "find_query=%add_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" - set found=0 - - %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" - echo "%path%"|findstr >nul /I /R ";%find_query%\"$" - if "!ERRORLEVEL!" == "0" set found=1 + if "%CMDER_CONFIGURED%" == "1" ( + %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" + echo "%path%"|findstr >nul /I /R ";%find_query%\"$" + if "!ERRORLEVEL!" == "0" set found=1 + ) %lib_console% debug_output :enhance_path "Env Var 1 - found=!found!" + if "!found!" == "0" ( - echo "%path%"|findstr >nul /i /r ";%find_query%;" - if "!ERRORLEVEL!" == "0" set found=1 + if "%CMDER_CONFIGURED%" == "1" ( + echo "%path%"|findstr >nul /i /r ";%find_query%;" + if "!ERRORLEVEL!" == "0" set found=1 + ) %lib_console% debug_output :enhance_path "Env Var 2 - found=!found!" )