From 0a5d1ac156ac8d1fc0e2e55a74c1501f051f3a2a Mon Sep 17 00:00:00 2001 From: Shahzeb Ihsan Date: Fri, 17 Mar 2017 10:26:57 +0800 Subject: [PATCH 001/371] Use cat -n for printing history to show cmd index Currently the "history" command in Cmder prints commands without any index associated with any command, so you can copy/paste a command or use "!!" to execute a command from the history but, unlike BASH, you can't do "!". "cat" has a switch, "-n", which prints line numbers of the file being printed. This, in conjunction with "history_io=3" in Clink settings (to read/write history when editing a command") works just like BASH, i.e., you can use the index printed next to a command in the history to execute that command as "!". --- vendor/user-aliases.cmd.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/user-aliases.cmd.example b/vendor/user-aliases.cmd.example index 01df318..5279705 100644 --- a/vendor/user-aliases.cmd.example +++ b/vendor/user-aliases.cmd.example @@ -9,7 +9,7 @@ gl=git log --oneline --all --graph --decorate $* ls=ls --show-control-chars -F --color $* pwd=cd clear=cls -history=cat %CMDER_ROOT%\config\.history +history=cat -n %CMDER_ROOT%\config\.history unalias=alias /d $1 vi=vim $* cmderr=cd /d "%CMDER_ROOT%" From d8444dae973322e1052a6773cffdb604e489154c Mon Sep 17 00:00:00 2001 From: Shahzeb Ihsan Date: Fri, 17 Mar 2017 10:59:12 +0800 Subject: [PATCH 002/371] Set history_io=3 in default Clink settings Currently the "history" command in Cmder prints commands without any index associated with any command, so you can copy/paste a command or use "!!" to execute a command from the history but, unlike BASH, you can't do "!". "cat" has a switch, "-n", which prints line numbers of the file being printed. This, in conjunction with "history_io=3" in Clink settings (to read/write history when editing a command") works just like BASH, i.e., you can use the index printed next to a command in the history to execute that command as "!". --- vendor/init.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/init.bat b/vendor/init.bat index 730efea..b874709 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -26,6 +26,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( :: Tell the user about the clink config files... if not exist "%CMDER_ROOT%\config\settings" ( + set clink.history_io=3 echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) From 864f7780998512f066d3146cba99705cca457fda Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 24 Mar 2018 08:03:28 -0500 Subject: [PATCH 003/371] load user clink --- .gitignore | 1 + vendor/clink.lua | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index cf231c5..eb66319 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ build/ Version v* *.bak config/user-* +config/*.lua config/settings config/aliases config/profile.d diff --git a/vendor/clink.lua b/vendor/clink.lua index 12d0616..e692951 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -351,3 +351,25 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do dofile(filename) 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 + +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 +end From 9462315789a57b155df26aac2ffecdba75ab4dd6 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 24 Mar 2018 08:57:14 -0500 Subject: [PATCH 004/371] fix /unregister --- launcher/src/CmderLauncher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6e3c923..bb62614 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -332,7 +332,7 @@ void UnregisterShellMenu(std::wstring opt, wchar_t* keyBaseName) { HKEY root = GetRootKey(opt); HKEY cmderKey; - FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL)); + // FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL)); FAIL_ON_ERROR(RegDeleteTree(cmderKey, NULL)); RegCloseKey(cmderKey); RegCloseKey(root); From a06d4e93ec3f033646c9b4f559ba6b3ef96fd7db Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Mon, 30 Apr 2018 20:31:01 +0800 Subject: [PATCH 005/371] Pass arguments to user-profile.cmd --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 380100a..6783116 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -290,14 +290,14 @@ if not defined HOME set "HOME=%USERPROFILE%" set "initialConfig=%CMDER_ROOT%\config\user-profile.cmd" if exist "%CMDER_ROOT%\config\user-profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_ROOT%\config\user-profile.cmd" + call "%CMDER_ROOT%\config\user-profile.cmd" %* ) if defined CMDER_USER_CONFIG ( set "initialConfig=%CMDER_USER_CONFIG%\user-profile.cmd" if exist "%CMDER_USER_CONFIG%\user-profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_USER_CONFIG%\user-profile.cmd" + call "%CMDER_USER_CONFIG%\user-profile.cmd" %* ) ) From 99f51b0fc0ffa0195d3d0f11903834f56a241bf1 Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Tue, 1 May 2018 13:02:21 +0800 Subject: [PATCH 006/371] fix conflict with init.bat build-in command parser, update user-profile.cmd --- vendor/init.bat | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 6783116..e68b331 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -81,6 +81,7 @@ call "%cmder_root%\vendor\lib\lib_profile" set SVN_SSH=%2 shift ) + set "CMDER_FLAGS=%CMDER_FLAGS% %1" shift goto var_loop @@ -290,14 +291,14 @@ if not defined HOME set "HOME=%USERPROFILE%" set "initialConfig=%CMDER_ROOT%\config\user-profile.cmd" if exist "%CMDER_ROOT%\config\user-profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_ROOT%\config\user-profile.cmd" %* + call "%CMDER_ROOT%\config\user-profile.cmd" %CMDER_FLAGS% ) if defined CMDER_USER_CONFIG ( set "initialConfig=%CMDER_USER_CONFIG%\user-profile.cmd" if exist "%CMDER_USER_CONFIG%\user-profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_USER_CONFIG%\user-profile.cmd" %* + call "%CMDER_USER_CONFIG%\user-profile.cmd" %CMDER_FLAGS% ) ) @@ -317,6 +318,12 @@ echo. echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. +echo :: pass your custom arguments to init.bat, and you can parse them like so +echo :: echo %* | find /i "/noautorun">nul +echo :: if "%ERRORLEVEL%" == "1" ( +echo :: call vsCode +echo :: ) +echo. echo @echo off ) >"%initialConfig%" ) From 9a3a8f23d077cf591ff13d9de651197eae305466 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Tue, 1 May 2018 08:57:02 -0400 Subject: [PATCH 007/371] Little Changes --- vendor/init.bat | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index e68b331..7379dae 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -10,6 +10,7 @@ set verbose-output=0 set debug-output=0 set max_depth=1 +set "CMDER_FLAGS=" :: Find root dir if not defined CMDER_ROOT ( @@ -80,8 +81,9 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1" == "/svn_ssh" ( set SVN_SSH=%2 shift + ) else ( + set "CMDER_FLAGS=%CMDER_FLAGS% %1" ) - set "CMDER_FLAGS=%CMDER_FLAGS% %1" shift goto var_loop @@ -318,7 +320,14 @@ echo. echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. -echo :: pass your custom arguments to init.bat, and you can parse them like so +echo :: Pass custom arguments to init.bat, and you can parse them like so: +echo :: If found... +echo :: echo %* | find /i "/noautorun">nul +echo :: if "%ERRORLEVEL%" == "0" ( +echo :: call vsCode +echo :: ) +echo. +echo :: If NOT found... echo :: echo %* | find /i "/noautorun">nul echo :: if "%ERRORLEVEL%" == "1" ( echo :: call vsCode From daa94c5462b864f4b0e6aab2ccc0eab5fe28a9b1 Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Fri, 4 May 2018 20:14:40 +0800 Subject: [PATCH 008/371] Optimize comments of using arguments in user-profile.cmd --- vendor/init.bat | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 7379dae..0b060f7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -320,17 +320,15 @@ echo. echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. -echo :: Pass custom arguments to init.bat, and you can parse them like so: -echo :: If found... -echo :: echo %* | find /i "/noautorun">nul -echo :: if "%ERRORLEVEL%" == "0" ( -echo :: call vsCode -echo :: ) +echo :: arguments in this batch are passed from init.bat, you can parse them like so: echo. -echo :: If NOT found... -echo :: echo %* | find /i "/noautorun">nul -echo :: if "%ERRORLEVEL%" == "1" ( -echo :: call vsCode +echo :: echo %* | find /i "/customOption">nul +echo :: if "%ERRORLEVEL%" == "0" ( +echo :: echo found /customOption. +echo :: do something. +echo :: ) else ( +echo :: echo not found /customOption. +echo :: do something. echo :: ) echo. echo @echo off From bf6dae4a24477a59cb98bac06ac4b895f59f90d5 Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Fri, 18 May 2018 20:32:05 +0800 Subject: [PATCH 009/371] feat: add have.bat as a wrapper --- bin/have.bat | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ vendor/init.bat | 20 ++++----- 2 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 bin/have.bat diff --git a/bin/have.bat b/bin/have.bat new file mode 100644 index 0000000..8007877 --- /dev/null +++ b/bin/have.bat @@ -0,0 +1,109 @@ +@echo off +setlocal + +if "%~1" equ "" goto :wrongSyntax + +if not defined CMDER_USER_FLAGS ( + exit /b +) + +set "haveBatNOT=false" +goto :parseArgument + +:doShift + shift + +:parseArgument +set "currenTarg=%~1" +if /i "%currenTarg%" == "/?" ( + goto :help +) else if /i "%currenTarg%" equ "/help" ( + goto :help +) else if /i "%currenTarg%" equ "/h" ( + goto :help +) else if /i "%currenTarg%" equ "NOT" ( + set "haveBatNOT=true" + goto :doShift +) else ( + if "%~1" equ "" goto :wrongSyntax + if "%~2" equ "" goto :wrongSyntax + set "haveBatArgName=%~1" + set "haveBatCommand=%~2" + goto :detect +) + +:detect +:: to avoid erroneous deteciton like "/do" "/doNOT", both have a "/do" +:: but if it works like "/do " "/doNOT ", "/do " won't match "/doN" +set "CMDER_USER_FLAGS=%CMDER_USER_FLAGS% " +set "haveBatArgName=%haveBatArgName% " +:: echo. +:: echo %CMDER_USER_FLAGS% +:: echo %haveBatNOT% +:: echo %haveBatArgName% +:: echo %haveBatCommand% +:: echo. +echo %CMDER_USER_FLAGS% | find /i "%haveBatArgName%">nul +if "%ERRORLEVEL%" == "0" ( + if "%haveBatNOT%" == "false" ( + call "%haveBatCommand%" + ) +) else ( + if "%haveBatNOT%" == "true" ( + call "%haveBatCommand%" + ) +) +exit /b + +:wrongSyntax +echo The syntax of the command is incorrect. +echo. +echo use /? for help +echo. +exit /b + +:help +echo have.bat +echo Handles with custom arguments for cmder's init.bat +echo written by xiazeyu, inspired DRSDavidSoft +echo. +echo Usage: +echo. +echo HAVE [NOT] argName command +echo. +echo NOT Specifies that have.bat should carry out +echo the command only if the condition is false. +echo. +echo argName Specifies which argument name is to detect. +echo. +echo command Specifies the command to carry out if the +echo argument name is detected. It's recommand to +echo use a pair of double quotation marks to +echo wrap your command to avoid exceed expectation. +echo. +echo Examples: +echo. +echo these examples are expected to be writted in /config/user-profile.cmd +echo it will use the environment varible "CMDER_USER_FLAGS" +echo. +echo Case 1: +echo. +echo The following command in user-profile.cmd would execute "notepad.exe" +echo. +echo call have "/startNotepad" "cmd /c start notepad.exe" +echo. +echo if you pass parameter to init.bat like: +echo. +echo init.bat /startNotepad +echo. +echo Case 2: +echo. +echo The following command in user-profile.cmd would execute "notepad.exe" +echo. +echo call have NOT "/dontStartNotepad" "cmd /c start notepad.exe" +echo. +echo UNLESS you pass parameter to init.bat like: +echo. +echo init.bat /dontStartNotepad +echo. +exit /b diff --git a/vendor/init.bat b/vendor/init.bat index 0b060f7..ef5c449 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -308,28 +308,26 @@ 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 :: the next one lines is for "have" shortcut, a custom arguments handler +echo :: don't remove it if you need it +echo set "CMDER_USER_FLAGS=%*" 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. echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. -echo :: arguments in this batch are passed from init.bat, you can parse them like so: +echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so: +echo :: more useage can be seen by typing "have /?" echo. -echo :: echo %* | find /i "/customOption">nul -echo :: if "%ERRORLEVEL%" == "0" ( -echo :: echo found /customOption. -echo :: do something. -echo :: ) else ( -echo :: echo not found /customOption. -echo :: do something. -echo :: ) +echo :: have "/customOption" "your custom command" echo. echo @echo off ) >"%initialConfig%" From add82a247b5cf9ad21a9a0dd244227be6d2603ae Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Fri, 18 May 2018 20:34:10 +0800 Subject: [PATCH 010/371] docs: update doc for have.bat --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66f5220..f3920fe 100644 --- a/README.md +++ b/README.md @@ -236,14 +236,76 @@ Uncomment and edit the below line in the script to use Cmder config even when la # CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. ``` +### Handling with custom arguments when using init.bat + +You can pass custom arguments to `init.bat` and use `have.bat` (or `have` for shortcut) to detect it. + +It is useful when you have multiple modes to execute cmder. + +If you use + +```batch + +init.bat /startNotepad + +``` + +to start init.bat with custom argument(`/startNotepad`) and put + +```batch + +call have "/startNotepad" "cmd /c start notepad.exe"` + +``` + +into `/config/user-profile.cmd`, then `notepad.exe` will be executed, and once you use + +```batch + +init.bat + +``` + +the `notepad.exe` won't be executed. + +Detailed usage of `have` can be seen by typing `have /?` in cmder. + +This feature is usually for external execution. + +In my case, I use `cmder` as an **entry point** of my portable working system, + +and I [integrated VSCode with cmder](https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration), it will **automatic execute VSCode** when I use `cmder.exe` to start. + +And when using integrated console in VSCode, VSCode **won't be executed again** as I use + +```json + +"terminal.integrated.shellArgs.windows": [ + "/k", + "%cmder_root%\\vendor\\init.bat", + "/noautorun" +], + +``` + +for `terminal.integrated.shellArgs.windows`, + +And here's the related fragment of my `user-profile.cmd`: + +```batch + +call have NOT "/noautorun" "cmd /c "start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace" + +``` + ## Upgrading The process of upgrading Cmder depends on the version/build you are currently running -If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer version of Cmder, follow the below process: +If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer version of Cmder, follow the below process: 1. Exit all Cmder sessions and relaunch `[cmder_root]/cmder.exe`, this backs up your existing `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`. - + * The `[cmder_root]/config/user-conemu.xml` contains any custom settings you have made using the 'Setup Tasks' settings dialog. 2. Exit all Cmder sessions and backup any files you have manually edited under `[cmder_root]/vendor`. @@ -253,7 +315,7 @@ If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer ver 3. Delete the `[cmder_root]/vendor` folder. 4. Extract the new `cmder.zip` or `cmder_mini.zip` into `[cmder_root]/` overwriting all files when prompted. -If you do not have a `[cmder_root]/config/user-conemu.xml`, you are running an older version of cmder, follow the below process: +If you do not have a `[cmder_root]/config/user-conemu.xml`, you are running an older version of cmder, follow the below process: 1. Exit all Cmder sessions and backup `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`. From 0ce1db97d05259efe40f69665486a0c2f031d903 Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Fri, 18 May 2018 21:02:36 +0800 Subject: [PATCH 011/371] fix: bug when no argument is passed in --- README.md | 2 +- bin/have.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3920fe..2751efe 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,7 @@ And here's the related fragment of my `user-profile.cmd`: ```batch -call have NOT "/noautorun" "cmd /c "start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace" +call have NOT "/noautorun" "cmd /c start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace" ``` diff --git a/bin/have.bat b/bin/have.bat index 8007877..0e5ad21 100644 --- a/bin/have.bat +++ b/bin/have.bat @@ -4,7 +4,7 @@ setlocal if "%~1" equ "" goto :wrongSyntax if not defined CMDER_USER_FLAGS ( - exit /b + set "CMDER_USER_FLAGS= " ) set "haveBatNOT=false" From 861f99d64b7bf6e73948a87f0eae6972cede20d1 Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Sun, 27 May 2018 10:22:44 +0800 Subject: [PATCH 012/371] rename /bin/have.bat to /vendor/lib/flag_exists.cmd Please use %flag_exists% instead of using have --- README.md | 12 +++--- vendor/init.bat | 9 +++-- bin/have.bat => vendor/lib/flag_exists.cmd | 45 ++++++++++++---------- 3 files changed, 35 insertions(+), 31 deletions(-) rename bin/have.bat => vendor/lib/flag_exists.cmd (69%) diff --git a/README.md b/README.md index 9b8f99d..0895c2c 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ Cmder, PowerShell, and Bash tabs all run on top of the Windows Console API and w You may however, choose to use an external installation of bash, such as Microsoft's [Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) (called WSL) or the [Cygwin](https://cygwin.com/) project which provides POSIX support on windows. -⚠ *NOTE:* Mintty tabs use a program called 'mintty' as the terminal emulator that is not based on the Windows Console API, rather it's rendered graphically by ConEmu. Mintty differs from the other tabs in that it supports xterm/xterm-256color TERM types, and does not work with ConEmu settings like color schemes and key bindings. As such, some differences in functionality are to be expected, such as Cmder not being able to apply a system-wide configuration to it. +⚠ *NOTE:* Mintty tabs use a program called 'mintty' as the terminal emulator that is not based on the Windows Console API, rather it's rendered graphically by ConEmu. Mintty differs from the other tabs in that it supports xterm/xterm-256color TERM types, and does not work with ConEmu settings like color schemes and key bindings. As such, some differences in functionality are to be expected, such as Cmder not being able to apply a system-wide configuration to it. As a result mintty specific config is done via the '[%USERPROFILE%|$HOME]/.minttyrc' file. You may read more about Mintty and its config file [here](https://github.com/mintty/mintty). @@ -248,7 +248,7 @@ Uncomment and edit the below line in the script to use Cmder config even when la ### Handling with custom arguments when using init.bat -You can pass custom arguments to `init.bat` and use `have.bat` (or `have` for shortcut) to detect it. +You can pass custom arguments to `init.bat` and use `%flag_exists%` to detect it. It is useful when you have multiple modes to execute cmder. @@ -264,7 +264,7 @@ to start init.bat with custom argument(`/startNotepad`) and put ```batch -call have "/startNotepad" "cmd /c start notepad.exe"` +call %flag_exists% "/startNotepad" "cmd /c start notepad.exe"` ``` @@ -278,7 +278,7 @@ init.bat the `notepad.exe` won't be executed. -Detailed usage of `have` can be seen by typing `have /?` in cmder. +Detailed usage of `%flag_exists%` can be seen by typing `%flag_exists% /?` in cmder. This feature is usually for external execution. @@ -304,11 +304,11 @@ And here's the related fragment of my `user-profile.cmd`: ```batch -call have NOT "/noautorun" "cmd /c start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace" +call %flag_exists% NOT "/noautorun" "cmd /c start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace" ``` -### Integrating Cmder with [Hyper](https://github.com/zeit/hyper), [Microsoft VS Code](https://code.visualstudio.com/), and your favorite IDEs +### Integrating Cmder with [Hyper](https://github.com/zeit/hyper), [Microsoft VS Code](https://code.visualstudio.com/), and your favorite IDEs Cmder by default comes with a vendored ConEmu installation as the underlying terminal emulator, as stated [here](https://conemu.github.io/en/cmder.html). However, Cmder can in fact run in a variety of other terminal emulators, and even integrated IDEs. Assuming you have the latest version of Cmder, follow the following instructions to get Cmder working with your own terminal emulator. diff --git a/vendor/init.bat b/vendor/init.bat index 5e4561e..4b1eef1 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -310,9 +310,10 @@ if not exist "%initialConfig%" ( echo :: use this file to run your own startup commands echo :: use in front of the command to prevent printing the command echo. -echo :: the next one lines is for "have" shortcut, a custom arguments handler +echo :: the next two lines is for "%%flag_exists%%" shortcut, a custom arguments handler echo :: don't remove it if you need it -echo set "CMDER_USER_FLAGS=%*" +echo set "CMDER_USER_FLAGS=%%*" +echo call "%%cmder_root%%\vendor\lib\flag_exists" echo. echo :: uncomment this to have the ssh agent load when cmder starts echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd" @@ -325,9 +326,9 @@ echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so: -echo :: more useage can be seen by typing "have /?" +echo :: more useage can be seen by typing "%%flag_exists%% /?" echo. -echo :: have "/customOption" "your custom command" +echo :: %%flag_exists%% "/customOption" "your custom command" echo. echo @echo off ) >"%initialConfig%" diff --git a/bin/have.bat b/vendor/lib/flag_exists.cmd similarity index 69% rename from bin/have.bat rename to vendor/lib/flag_exists.cmd index 0e5ad21..776aafb 100644 --- a/bin/have.bat +++ b/vendor/lib/flag_exists.cmd @@ -1,4 +1,5 @@ @echo off +set "flag_exists=%~dp0flag_exists" setlocal if "%~1" equ "" goto :wrongSyntax @@ -7,7 +8,7 @@ if not defined CMDER_USER_FLAGS ( set "CMDER_USER_FLAGS= " ) -set "haveBatNOT=false" +set "feNOT=false" goto :parseArgument :doShift @@ -22,13 +23,13 @@ if /i "%currenTarg%" == "/?" ( ) else if /i "%currenTarg%" equ "/h" ( goto :help ) else if /i "%currenTarg%" equ "NOT" ( - set "haveBatNOT=true" + set "feNOT=true" goto :doShift ) else ( if "%~1" equ "" goto :wrongSyntax if "%~2" equ "" goto :wrongSyntax - set "haveBatArgName=%~1" - set "haveBatCommand=%~2" + set "feArgName=%~1" + set "feCommand=%~2" goto :detect ) @@ -36,21 +37,21 @@ if /i "%currenTarg%" == "/?" ( :: to avoid erroneous deteciton like "/do" "/doNOT", both have a "/do" :: but if it works like "/do " "/doNOT ", "/do " won't match "/doN" set "CMDER_USER_FLAGS=%CMDER_USER_FLAGS% " -set "haveBatArgName=%haveBatArgName% " +set "feArgName=%feArgName% " :: echo. :: echo %CMDER_USER_FLAGS% -:: echo %haveBatNOT% -:: echo %haveBatArgName% -:: echo %haveBatCommand% +:: echo %feNOT% +:: echo %feArgName% +:: echo %feCommand% :: echo. -echo %CMDER_USER_FLAGS% | find /i "%haveBatArgName%">nul +echo %CMDER_USER_FLAGS% | find /i "%feArgName%">nul if "%ERRORLEVEL%" == "0" ( - if "%haveBatNOT%" == "false" ( - call "%haveBatCommand%" + if "%feNOT%" == "false" ( + call "%feCommand%" ) ) else ( - if "%haveBatNOT%" == "true" ( - call "%haveBatCommand%" + if "%feNOT%" == "true" ( + call "%feCommand%" ) ) exit /b @@ -63,22 +64,24 @@ echo. exit /b :help -echo have.bat -echo Handles with custom arguments for cmder's init.bat -echo written by xiazeyu, inspired DRSDavidSoft +echo. +echo %%flag_exists%% +echo. +echo Handles with custom arguments for cmder's init.bat. +echo written by xiazeyu, inspired DRSDavidSoft. echo. echo Usage: echo. -echo HAVE [NOT] argName command +echo %%flag_exists%% [NOT] argName command echo. -echo NOT Specifies that have.bat should carry out +echo NOT Specifies that %%flag_exists%% should carry out echo the command only if the condition is false. echo. echo argName Specifies which argument name is to detect. echo. echo command Specifies the command to carry out if the echo argument name is detected. It's recommand to -echo use a pair of double quotation marks to +echo use a pair of double quotation marks to echo wrap your command to avoid exceed expectation. echo. echo Examples: @@ -90,7 +93,7 @@ echo Case 1: echo. echo The following command in user-profile.cmd would execute "notepad.exe" echo. -echo call have "/startNotepad" "cmd /c start notepad.exe" +echo call %%flag_exists%% "/startNotepad" "cmd /c start notepad.exe" echo. echo if you pass parameter to init.bat like: echo. @@ -100,7 +103,7 @@ echo Case 2: echo. echo The following command in user-profile.cmd would execute "notepad.exe" echo. -echo call have NOT "/dontStartNotepad" "cmd /c start notepad.exe" +echo call %%flag_exists%% NOT "/dontStartNotepad" "cmd /c start notepad.exe" echo. echo UNLESS you pass parameter to init.bat like: echo. From 0f99f66b42158f3ecf528e16bc3a8692b6e38e22 Mon Sep 17 00:00:00 2001 From: Bob Hood Date: Fri, 6 Jul 2018 14:34:48 -0600 Subject: [PATCH 013/371] Refactored the Mercurial prompt code to be more efficient. --- vendor/clink.lua | 49 ++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 5c64c03..153aa8f 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -285,31 +285,40 @@ end local function hg_prompt_filter() - -- Colors for mercurial status - local colors = { - clean = "\x1b[1;37;40m", - dirty = "\x1b[31;1m", - } + local result = "" - if get_hg_dir() then - -- if we're inside of mercurial repo then try to detect current branch - local branch = get_hg_branch() - local color - if branch then - -- Has branch => therefore it is a mercurial folder, now figure out status - if get_hg_status() then - color = colors.clean - else - color = colors.dirty + local hg_dir = get_hg_dir() + if hg_dir then + -- Colors for mercurial status + local colors = { + clean = "\x1b[1;37;40m", + dirty = "\x1b[31;1m", + } + + -- 'hg id' gives us BOTH the branch name AND an indicator that there + -- are uncommitted changes, in one fast(er) call + local pipe = io.popen("hg id 2>&1") + local output = pipe:read('*all') + local rc = { pipe:close() } + + if output ~= nil and + string.sub(output,1,7) ~= "abort: " and -- not an HG working copy + string.sub(output,1,12) ~= "000000000000" and -- empty wc (needs update) + (not string.find(output, "is not recognized")) then -- 'hg' not in path + local color = colors.clean + -- split elements on space delimiter + local items = {} + for i in string.gmatch(output, "%S+") do + table.insert(items, i) end - - clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", color.."("..branch..")") - return false + -- if the repo hash ends with '+', the wc has uncommitted changes + if string.sub(items[1], -1, -1) == "+" then color = colors.dirty end + -- substitute the branch in directly -- already WITH parentheses. :) + result = color .. items[2] -- string.sub(items[2], 1, string.len(items[2]) - 1) end end - -- No mercurial present or not in mercurial file - clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", "") + clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", result) return false end From b57e146e7a2b096f435c1855b451a53e72e3e1e2 Mon Sep 17 00:00:00 2001 From: xiazeyu_2011 Date: Tue, 17 Jul 2018 14:11:16 +0800 Subject: [PATCH 014/371] docs: migrated instructions to the wiki pages --- README.md | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/README.md b/README.md index 0895c2c..73d12ec 100644 --- a/README.md +++ b/README.md @@ -280,35 +280,8 @@ the `notepad.exe` won't be executed. Detailed usage of `%flag_exists%` can be seen by typing `%flag_exists% /?` in cmder. -This feature is usually for external execution. - -In my case, I use `cmder` as an **entry point** of my portable working system, - -and I [integrated VSCode with cmder](https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration), it will **automatic execute VSCode** when I use `cmder.exe` to start. - -And when using integrated console in VSCode, VSCode **won't be executed again** as I use - -```json - -"terminal.integrated.shellArgs.windows": [ - "/k", - "%cmder_root%\\vendor\\init.bat", - "/noautorun" -], - -``` - -for `terminal.integrated.shellArgs.windows`, - -And here's the related fragment of my `user-profile.cmd`: - -```batch - -call %flag_exists% NOT "/noautorun" "cmd /c start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace" - -``` - ### Integrating Cmder with [Hyper](https://github.com/zeit/hyper), [Microsoft VS Code](https://code.visualstudio.com/), and your favorite IDEs + Cmder by default comes with a vendored ConEmu installation as the underlying terminal emulator, as stated [here](https://conemu.github.io/en/cmder.html). However, Cmder can in fact run in a variety of other terminal emulators, and even integrated IDEs. Assuming you have the latest version of Cmder, follow the following instructions to get Cmder working with your own terminal emulator. From b3200efa7ebabe3bbbd2a36b8941bbef935c1dda Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Mon, 6 Aug 2018 11:25:27 +0800 Subject: [PATCH 015/371] doc: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73d12ec..50e1c16 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can | Argument | Description | | ------------------- | ----------------------------------------------------------------------- | | /C [user_root_path] | Individual user Cmder root folder. Example: %userprofile%\cmder_config | -| /SINGLE | Start Cmder is single mode. | +| /SINGLE | Start Cmder in single mode. | | /START [start_path] | Folder path to start in. | | /TASK [task_name] | Task to start after launch. | From f6c2d9c31e86666cae35ff17911c5495452b587b Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Mon, 6 Aug 2018 13:09:59 +0800 Subject: [PATCH 016/371] refactor: reduce global varible useage, fixed quote issue, added parameters support --- README.md | 3 +- vendor/init.bat | 14 ++++---- vendor/lib/flag_exists.cmd | 73 ++++++++++++++++++++++++-------------- 3 files changed, 55 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 50e1c16..4dcdfd0 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ | /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-liases.cmd' | | /v | Enables verbose output. | not set | +| (custom arguments) | User defined arguments processed by `flag_exists`. Type `%flag_exists% /?` 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: @@ -278,7 +279,7 @@ init.bat the `notepad.exe` won't be executed. -Detailed usage of `%flag_exists%` can be seen by typing `%flag_exists% /?` in cmder. +To see detailed usage of `%flag_exists%`, type `%flag_exists% /?` in cmder. ### Integrating Cmder with [Hyper](https://github.com/zeit/hyper), [Microsoft VS Code](https://code.visualstudio.com/), and your favorite IDEs diff --git a/vendor/init.bat b/vendor/init.bat index 4b1eef1..a9a553e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -7,10 +7,11 @@ :: !!! 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 -set "CMDER_FLAGS=" +set "CMDER_USER_FLAGS= " :: Find root dir if not defined CMDER_ROOT ( @@ -82,7 +83,7 @@ call "%cmder_root%\vendor\lib\lib_profile" set SVN_SSH=%2 shift ) else ( - set "CMDER_FLAGS=%CMDER_FLAGS% %1" + set "CMDER_USER_FLAGS=%1 %CMDER_USER_FLAGS%" ) shift goto var_loop @@ -293,14 +294,14 @@ if not defined HOME set "HOME=%USERPROFILE%" set "initialConfig=%CMDER_ROOT%\config\user-profile.cmd" if exist "%CMDER_ROOT%\config\user-profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_ROOT%\config\user-profile.cmd" %CMDER_FLAGS% + call "%CMDER_ROOT%\config\user-profile.cmd" ) if defined CMDER_USER_CONFIG ( set "initialConfig=%CMDER_USER_CONFIG%\user-profile.cmd" if exist "%CMDER_USER_CONFIG%\user-profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_USER_CONFIG%\user-profile.cmd" %CMDER_FLAGS% + call "%CMDER_USER_CONFIG%\user-profile.cmd" ) ) @@ -312,8 +313,7 @@ echo :: use in front of the command to prevent printing the command echo. echo :: the next two lines is for "%%flag_exists%%" shortcut, a custom arguments handler echo :: don't remove it if you need it -echo set "CMDER_USER_FLAGS=%%*" -echo call "%%cmder_root%%\vendor\lib\flag_exists" +echo call "%%cmder_root%%\vendor\lib\flag_exists" "/setPath" echo. echo :: uncomment this to have the ssh agent load when cmder starts echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd" @@ -328,7 +328,7 @@ echo. echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so: echo :: more useage can be seen by typing "%%flag_exists%% /?" echo. -echo :: %%flag_exists%% "/customOption" "your custom command" +echo :: %%flag_exists%% "/customOption" "command/program" echo. echo @echo off ) >"%initialConfig%" diff --git a/vendor/lib/flag_exists.cmd b/vendor/lib/flag_exists.cmd index 776aafb..c144340 100644 --- a/vendor/lib/flag_exists.cmd +++ b/vendor/lib/flag_exists.cmd @@ -1,59 +1,67 @@ @echo off -set "flag_exists=%~dp0flag_exists" setlocal if "%~1" equ "" goto :wrongSyntax if not defined CMDER_USER_FLAGS ( + :: in case nothing was passed to %CMDER_USER_FLAGS% set "CMDER_USER_FLAGS= " ) -set "feNOT=false" +set "feNot=false" goto :parseArgument :doShift shift :parseArgument -set "currenTarg=%~1" -if /i "%currenTarg%" == "/?" ( +set "currenArgu=%~1" +if /i "%currenArgu%" equ "/setPath" ( + :: set %flag_exists% shortcut + endlocal + set "flag_exists=%~dp0flag_exists" +) else if /i "%currenArgu%" == "/?" ( goto :help -) else if /i "%currenTarg%" equ "/help" ( +) else if /i "%currenArgu%" equ "/help" ( goto :help -) else if /i "%currenTarg%" equ "/h" ( +) else if /i "%currenArgu%" equ "/h" ( goto :help -) else if /i "%currenTarg%" equ "NOT" ( - set "feNOT=true" +) else if /i "%currenArgu%" equ "NOT" ( + set "feNot=true" goto :doShift ) else ( if "%~1" equ "" goto :wrongSyntax if "%~2" equ "" goto :wrongSyntax - set "feArgName=%~1" + set "feFlagName=%~1" set "feCommand=%~2" + if not "%~3" equ "" ( + set "feParam=%~3" + ) goto :detect ) :detect -:: to avoid erroneous deteciton like "/do" "/doNOT", both have a "/do" -:: but if it works like "/do " "/doNOT ", "/do " won't match "/doN" -set "CMDER_USER_FLAGS=%CMDER_USER_FLAGS% " -set "feArgName=%feArgName% " +:: to avoid erroneous deteciton like "/do" "/doNOT", which both have a "/do" +:: we added a space after the flag name, like "/do ", which won't match "/doN" +set "feFlagName=%feFlagName% " :: echo. :: echo %CMDER_USER_FLAGS% :: echo %feNOT% -:: echo %feArgName% +:: echo %feFlagName% :: echo %feCommand% +:: echo %feParam% :: echo. -echo %CMDER_USER_FLAGS% | find /i "%feArgName%">nul +echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul if "%ERRORLEVEL%" == "0" ( if "%feNOT%" == "false" ( - call "%feCommand%" + call %feCommand% %feParam% ) ) else ( if "%feNOT%" == "true" ( - call "%feCommand%" + call %feCommand% %feParam% ) ) +endlocal exit /b :wrongSyntax @@ -61,6 +69,7 @@ echo The syntax of the command is incorrect. echo. echo use /? for help echo. +endlocal exit /b :help @@ -72,17 +81,26 @@ echo written by xiazeyu, inspired DRSDavidSoft. echo. echo Usage: echo. -echo %%flag_exists%% [NOT] argName command +echo %%flag_exists%% [/setPath] [NOT] flagName command/program [parameters] echo. -echo NOT Specifies that %%flag_exists%% should carry out -echo the command only if the condition is false. +echo setPath Generate a global varible %%flag_exists%% for +echo quicker use. Following arguments will be ignored. echo. -echo argName Specifies which argument name is to detect. +echo NOT Specifies that %%flag_exists%% should carry out +echo the command only if the flag is missing. echo. -echo command Specifies the command to carry out if the -echo argument name is detected. It's recommand to -echo use a pair of double quotation marks to -echo wrap your command to avoid exceed expectation. +echo flagName Specifies which flag name is to detect. It's recommand +echo to use a pair of double quotation marks to wrap +echo your flag name to avoid exceed expectation. +echo. +echo command/program Specifies the command to carry out if the +echo argument name is detected. It's recommand to +echo use a pair of double quotation marks to +echo wrap your command to avoid exceed expectation. +echo. +echo parameters These are the parameters passed to the command/program. +echo It's recommand to use a pair of double quotation marks +echo to wrap your flag name to avoid exceed expectation. echo. echo Examples: echo. @@ -93,7 +111,7 @@ echo Case 1: echo. echo The following command in user-profile.cmd would execute "notepad.exe" echo. -echo call %%flag_exists%% "/startNotepad" "cmd /c start notepad.exe" +echo call %%flag_exists%% "/startNotepad" "start" "notepad.exe" echo. echo if you pass parameter to init.bat like: echo. @@ -103,10 +121,11 @@ echo Case 2: echo. echo The following command in user-profile.cmd would execute "notepad.exe" echo. -echo call %%flag_exists%% NOT "/dontStartNotepad" "cmd /c start notepad.exe" +echo call %%flag_exists%% NOT "/dontStartNotepad" "start" "notepad.exe" echo. echo UNLESS you pass parameter to init.bat like: echo. echo init.bat /dontStartNotepad echo. +endlocal exit /b From f4ee915678cef7dfdb664627212e27041537a593 Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Mon, 6 Aug 2018 13:21:45 +0800 Subject: [PATCH 017/371] docs: update to latest useage --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00008b4..b97204e 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ to start init.bat with custom argument(`/startNotepad`) and put ```batch -call %flag_exists% "/startNotepad" "cmd /c start notepad.exe"` +call %flag_exists% "/startNotepad" "start" "notepad.exe"` ``` From 39f47870a339c99e7526920ec3e06b875db8890b Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Mon, 6 Aug 2018 16:05:31 +0800 Subject: [PATCH 018/371] chore: unite slash --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index a419482..99a86e7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -320,7 +320,7 @@ echo :: use in front of the command to prevent printing the command echo. echo :: the next two lines is for "%%flag_exists%%" shortcut, a custom arguments handler echo :: don't remove it if you need it -echo call "%%cmder_root%%\vendor\lib\flag_exists" "/setPath" +echo call "%%cmder_root%%/vendor/lib/flag_exists" "/setPath" echo. echo :: uncomment this to have the ssh agent load when cmder starts echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd" From e69e7f9b82a5bd002412a5f684d5a52c1997457b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 14:59:40 -0400 Subject: [PATCH 019/371] run user lua afer cmder lua --- launcher/src/CmderLauncher.cpp | 2 +- vendor/clink.lua | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index bfb7918..9f0a275 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -363,7 +363,7 @@ void UnregisterShellMenu(std::wstring opt, wchar_t* keyBaseName) { HKEY root = GetRootKey(opt); HKEY cmderKey; - // FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL)); + FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL)); FAIL_ON_ERROR(RegDeleteTree(cmderKey, NULL)); RegDeleteKeyEx(root, keyBaseName, KEY_ALL_ACCESS, NULL); RegCloseKey(cmderKey); diff --git a/vendor/clink.lua b/vendor/clink.lua index 35acb73..9db28fc 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -370,13 +370,15 @@ for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do end end -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 +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 + end end From 059a31618bf07e3e7351fb3ae9f5899a94d06d1a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 15:32:43 -0400 Subject: [PATCH 020/371] cleanup --- vendor/clink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 9db28fc..cc1bc83 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -370,7 +370,7 @@ for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do end end -if clink.get_env('CMDER_USER_CONFIG') then +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 From c25ff751871cd931e28cdbc9be755b023167e009 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 17:37:27 -0400 Subject: [PATCH 021/371] move bin\alias.bat to vendor\bin\alias.cmd --- bin/alias.bat | 131 ------------------------------------------------ vendor/init.bat | 13 +++++ 2 files changed, 13 insertions(+), 131 deletions(-) delete mode 100644 bin/alias.bat diff --git a/bin/alias.bat b/bin/alias.bat deleted file mode 100644 index 03696f6..0000000 --- a/bin/alias.bat +++ /dev/null @@ -1,131 +0,0 @@ -@echo off - - -if "%ALIASES%" == "" ( - set ALIASES="%CMDER_ROOT%\config\user-aliases.cmd" -) - -setlocal enabledelayedexpansion - -if "%~1" == "" echo Use /? for help & echo. & goto :p_show - -:: check command usage - -rem #region parseargument -goto parseargument - -:do_shift - shift - -:parseargument - set currentarg=%~1 - - if /i "%currentarg%" equ "/f" ( - set ALIASES=%~2 - shift - goto :do_shift - ) else if /i "%currentarg%" == "/reload" ( - goto :p_reload - ) else if "%currentarg%" equ "/?" ( - goto :p_help - ) else if /i "%currentarg%" equ "/d" ( - if "%~2" neq "" ( - if "%~3" equ "" ( - :: /d flag for delete existing alias - call :p_del %~2 - shift - goto :eof - ) - ) - ) else if "%currentarg%" neq "" ( - if "%~2" equ "" ( - :: Show the specified alias - doskey /macros | findstr /b %currentarg%= && exit /b - echo insufficient parameters. - goto :p_help - ) else ( - :: handle quotes within command definition, e.g. quoted long file names - set _x=%* - ) - ) -rem #endregion parseargument - -if "%ALIASES%" neq "%CMDER_ROOT%\config\user-aliases.cmd" ( - set _x=!_x:/f "%ALIASES%" =! - - if not exist "%ALIASES%" ( - echo ;= @echo off>"%ALIASES%" - echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%" - echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%" - echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%" - echo ;= goto:eof>>"%ALIASES%" - echo ;= Add aliases below here>>"%ALIASES%" - ) -) - -:: validate alias -for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( - set alias_name=%%G - set alias_value=%%H -) - -:: leading quotes added while validating -set alias_name=%alias_name:~1% - -:: trailing quotes added while validating -set alias_value=%alias_value:~0,-1% - -::remove spaces -set _temp=%alias_name: =% - -if not ["%_temp%"] == ["%alias_name%"] ( - echo Your alias name can not contain a space - endlocal - exit /b -) - -:: replace already defined alias -findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" -echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" -doskey /macrofile="%ALIASES%" -endlocal -exit /b - -:p_del -set del_alias=%~1 -findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" -type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" -doskey %del_alias%= -doskey /macrofile="%ALIASES%" -goto:eof - -:p_reload -doskey /macrofile="%ALIASES%" -echo Aliases reloaded -exit /b - -:p_show -doskey /macros|findstr /v /r "^;=" | sort -exit /b - -:p_help -echo.Usage: -echo. -echo. alias [options] [alias=full command] -echo. -echo.Options: -echo. -echo. /d [alias] Delete an [alias]. -echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. -echo. Default: %cmder_root%\config\user-aliases.cmd -echo. /reload Reload the aliases file. Can be used with /f argument. -echo. Default: %cmder_root%\config\user-aliases.cmd -echo. -echo. If alias is called with no parameters, it will display the list of existing aliases. -echo. -echo. In the command, you can use the following notations: -echo. $* allows the alias to assume all the parameters of the supplied command. -echo. $1-$9 Allows you to seperate parameter by number, much like %%1 in batch. -echo. $T is the command seperator, allowing you to string several commands together into one alias. -echo. For more information, read DOSKEY/? -exit /b diff --git a/vendor/init.bat b/vendor/init.bat index bf0b120..1abffed 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -218,6 +218,7 @@ goto :PATH_ENHANCE endlocal :PATH_ENHANCE +%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% if defined CMDER_USER_BIN ( %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth% @@ -331,5 +332,17 @@ echo @echo off ) >"%initialConfig%" ) +if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( + echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd' + echo to get rid of this message either: + echo. + echo Delete the file '%CMDER_ROOT%\bin\alias.bat' + echo. + echo or + echo. + echo Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd' if you + echo have customized it and want to continue using it instead of the included version. +) + set initialConfig= exit /b From 70788dc1e555e2ac3e18401dbb22653a3da9290e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 17:43:53 -0400 Subject: [PATCH 022/371] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 96f5762..bb66d82 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ config/profile.d .github_changelog_generator launcher/.vs launcher/src/version.rc2 +!bin/Readme.md From 451fb46ce14df254734f5e2900bfd19a35c8d369 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 18:17:09 -0400 Subject: [PATCH 023/371] move user-aliases.cmd to user_aliases.cmd --- launcher/src/CmderLauncher.cpp | 30 +++++++++++++++++++++++ vendor/init.bat | 44 +++++++++++++++++----------------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 9f0a275..6ca5015 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -88,6 +88,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t userProfiledDirPath[MAX_PATH] = { 0 }; wchar_t userProfilePath[MAX_PATH] = { 0 }; wchar_t legacyUserProfilePath[MAX_PATH] = { 0 }; + wchar_t userAliasesPath[MAX_PATH] = { 0 }; + wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 }; wchar_t args[MAX_PATH * 2 + 256] = { 0 }; std::wstring cmderStart = path; @@ -122,6 +124,20 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + PathCombine(legacyUserAliasesPath, configDirPath, L"user-aliases.cmd"); + if (PathFileExists(legacyUserAliasesPath)) { + PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); + + char *lPr = (char *)malloc(MAX_PATH); + char *pR = (char *)malloc(MAX_PATH); + size_t i; + wcstombs_s(&i, lPr, (size_t)MAX_PATH, + legacyUserAliasesPath, (size_t)MAX_PATH); + wcstombs_s(&i, pR, (size_t)MAX_PATH, + userAliasesPath, (size_t)MAX_PATH); + rename(lPr, pR); + } + if (wcscmp(userConfigDirPath, L"") == 0) { PathCombine(userConfigDirPath, exeDir, L"config"); @@ -150,6 +166,20 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr userProfilePath, (size_t)MAX_PATH); rename(lPr, pR); } + + PathCombine(legacyUserAliasesPath, userConfigDirPath, L"user-aliases.cmd"); + if (PathFileExists(legacyUserAliasesPath)) { + PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); + + char *lPr = (char *)malloc(MAX_PATH); + char *pR = (char *)malloc(MAX_PATH); + size_t i; + wcstombs_s(&i, lPr, (size_t)MAX_PATH, + legacyUserAliasesPath, (size_t)MAX_PATH); + wcstombs_s(&i, pR, (size_t)MAX_PATH, + userAliasesPath, (size_t)MAX_PATH); + rename(lPr, pR); + } } // Set path to vendored ConEmu config file diff --git a/vendor/init.bat b/vendor/init.bat index 1abffed..38909be 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -58,7 +58,7 @@ call "%cmder_root%\vendor\lib\lib_profile" ) ) else if /i "%1" == "/user_aliases" ( if exist "%~2" ( - set "user-aliases=%~2" + set "user_aliases=%~2" shift ) ) else if /i "%1" == "/git_install_root" ( @@ -236,53 +236,53 @@ if defined CMDER_USER_CONFIG ( :: scripts run above by setting the 'aliases' env variable. :: :: Note: If overriding default aliases store file the aliases -:: must also be self executing, see '.\user-aliases.cmd.example', +:: must also be self executing, see '.\user_aliases.cmd.example', :: and be in profile.d folder. -if not defined user-aliases ( +if not defined user_aliases ( if defined CMDER_USER_CONFIG ( - set "user-aliases=%CMDER_USER_CONFIG%\user-aliases.cmd" + set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd" ) else ( - set "user-aliases=%CMDER_ROOT%\config\user-aliases.cmd" + set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd" ) ) :: The aliases environment variable is used by alias.bat to id :: the default file to store new aliases in. if not defined aliases ( - set "aliases=%user-aliases%" + set "aliases=%user_aliases%" ) -:: Make sure we have a self-extracting user-aliases.cmd file +:: Make sure we have a self-extracting user_aliases.cmd file setlocal enabledelayedexpansion -if not exist "%user-aliases%" ( - echo Creating initial user-aliases store in "%user-aliases%"... - copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%" +if not exist "%user_aliases%" ( + echo Creating initial user_aliases store in "%user_aliases%"... + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" ) else ( - type "%user-aliases%" | findstr /i ";= Add aliases below here" >nul + type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul if "!errorlevel!" == "1" ( - echo Creating initial user-aliases store in "%user-aliases%"... + echo Creating initial user_aliases store in "%user_aliases%"... if defined CMDER_USER_CONFIG ( - copy "%user-aliases%" "%user-aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%" + copy "%user_aliases%" "%user_aliases%.old_format" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" ) else ( - copy "%user-aliases%" "%user-aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%" + copy "%user_aliases%" "%user_aliases%.old_format" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" ) ) ) -:: Update old 'user-aliases' to new self executing 'user-aliases.cmd' +:: Update old 'user_aliases' to new self executing 'user_aliases.cmd' if exist "%CMDER_ROOT%\config\aliases" ( echo Updating old "%CMDER_ROOT%\config\aliases" to new format... - type "%CMDER_ROOT%\config\aliases" >> "%user-aliases%" && del "%CMDER_ROOT%\config\aliases" -) else if exist "%user-aliases%.old_format" ( - echo Updating old "%user-aliases%" to new format... - type "%user-aliases%.old_format" >> "%user-aliases%" && del "%user-aliases%.old_format" + type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" && del "%CMDER_ROOT%\config\aliases" +) else if exist "%user_aliases%.old_format" ( + echo Updating old "%user_aliases%" to new format... + type "%user_aliases%.old_format" >> "%user_aliases%" && del "%user_aliases%.old_format" ) endlocal :: Add aliases to the environment -call "%user-aliases%" +call "%user_aliases%" :: See vendor\git-for-windows\README.portable for why we do this :: Basically we need to execute this post-install.bat because we are From 7d40ea4609cc9c04e597ee69b9cf2556042bf0ef Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 18:32:21 -0400 Subject: [PATCH 024/371] modify message --- vendor/init.bat | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 38909be..7d35a0f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -340,8 +340,9 @@ if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cm echo. echo or echo. - echo Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd' if you - echo have customized it and want to continue using it instead of the included version. + echo If you have customized it and want to continue using it instead of the included version + echo * Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd'. + echo * Search for 'user-aliases' and replace it with 'user_aliases'. ) set initialConfig= From 75e6644d2a745b12aa309abaff92c48c16fbe699 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 18:35:02 -0400 Subject: [PATCH 025/371] rename --- vendor/{user-aliases.cmd.example => user_aliases.cmd.example} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename vendor/{user-aliases.cmd.example => user_aliases.cmd.example} (100%) diff --git a/vendor/user-aliases.cmd.example b/vendor/user_aliases.cmd.example similarity index 100% rename from vendor/user-aliases.cmd.example rename to vendor/user_aliases.cmd.example From 541fc16daf50fbe6cd8f87e2b570e04ab22c447e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 22:08:00 -0500 Subject: [PATCH 026/371] Trying to get tcc working --- vendor/init.bat | 135 +++++++++++++++++++------------------ vendor/lib/lib_console.cmd | 18 ++--- vendor/lib/lib_git.cmd | 14 ++-- vendor/lib/lib_path.cmd | 28 ++++---- 4 files changed, 101 insertions(+), 94 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 7d35a0f..ed3a900 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -7,8 +7,8 @@ :: !!! 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. -set verbose-output=0 -set debug-output=0 +set verbose_output=0 +set debug_output=0 set max_depth=1 :: Find root dir @@ -37,9 +37,9 @@ call "%cmder_root%\vendor\lib\lib_profile" if "%~1" == "" ( goto :start ) else if /i "%1"=="/v" ( - set verbose-output=1 + set verbose_output=1 ) else if /i "%1"=="/d" ( - set debug-output=1 + set debug_output=1 ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" @@ -62,11 +62,11 @@ call "%cmder_root%\vendor\lib\lib_profile" shift ) ) else if /i "%1" == "/git_install_root" ( - if exist "%~2" ( + if exist "%2\cmd\git.exe" ( set "GIT_INSTALL_ROOT=%~2" shift ) else ( - %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\cmd\git.exe", you specified does not exist!" exit /b ) ) else if /i "%1" == "/home" ( @@ -85,11 +85,11 @@ call "%cmder_root%\vendor\lib\lib_profile" goto var_loop :start -%lib_console% debug-output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" -%lib_console% debug-output init.bat "Env Var - debug-output=%debug-output%" +%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" +%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" if defined CMDER_USER_CONFIG ( - %lib_console% debug-output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" + %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" ) :: Pick right version of clink @@ -101,21 +101,24 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture_bits=64 ) -:: Tell the user about the clink config files... -if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( - echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" - echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ +echo %comspec% |find /i "tcc.exe">nul +if %errorlevel% == 1 ( + :: Tell the user about the clink config files... + if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( + echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" + echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ + + ) else if not exist "%CMDER_ROOT%\config\settings" ( + echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" + echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. + ) -} else if not exist "%CMDER_ROOT%\config\settings" ( - echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" - echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. -) - -:: Run clink -if defined CMDER_USER_CONFIG ( - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" -) else ( - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" + :: Run clink + if defined CMDER_USER_CONFIG ( + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" + ) else ( + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" + ) ) :: Prepare for git-for-windows @@ -134,7 +137,7 @@ if defined GIT_INSTALL_ROOT ( if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :FOUND_GIT) ) -%lib_console% debug-output init.bat "Looking for Git install root..." +%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" @@ -165,19 +168,18 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( set test_dir= goto :FOUND_GIT ) else ( - call :verbose-output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... + call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... set test_dir= ) ) else ( :: if the user provided git executable is not found if !errorlevel! equ -255 ( - call :verbose-output No git at "!git_executable!" found. + call :verbose_output No git at "!git_executable!" found. set test_dir= ) ) - ) :: our last hope: our own git... @@ -209,8 +211,8 @@ if defined GIT_INSTALL_ROOT ( ) endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug-output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug-output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" +%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" +%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" goto :PATH_ENHANCE :NO_GIT @@ -246,41 +248,45 @@ if not defined user_aliases ( ) ) -:: The aliases environment variable is used by alias.bat to id -:: the default file to store new aliases in. -if not defined aliases ( - set "aliases=%user_aliases%" -) -:: Make sure we have a self-extracting user_aliases.cmd file -setlocal enabledelayedexpansion -if not exist "%user_aliases%" ( - echo Creating initial user_aliases store in "%user_aliases%"... - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" -) else ( - type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul - if "!errorlevel!" == "1" ( - echo Creating initial user_aliases store in "%user_aliases%"... - if defined CMDER_USER_CONFIG ( - copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" - ) else ( - copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" - ) - ) +echo %comspec% |find /i "tcc.exe">nul +if %errorlevel% == 1 ( + :: The aliases environment variable is used by alias.bat to id + :: the default file to store new aliases in. + if not defined aliases ( + set "aliases=%user_aliases%" + ) + + :: Make sure we have a self-extracting user_aliases.cmd file + setlocal enabledelayedexpansion + if not exist "%user_aliases%" ( + echo Creating initial user_aliases store in "%user_aliases%"... + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" + ) else ( + type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul + if "!errorlevel!" == "1" ( + echo Creating initial user_aliases store in "%user_aliases%"... + if defined CMDER_USER_CONFIG ( + copy "%user_aliases%" "%user_aliases%.old_format" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" + ) else ( + copy "%user_aliases%" "%user_aliases%.old_format" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" + ) + ) + ) + + :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' + if exist "%CMDER_ROOT%\config\aliases" ( + echo Updating old "%CMDER_ROOT%\config\aliases" to new format... + type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" && del "%CMDER_ROOT%\config\aliases" + ) else if exist "%user_aliases%.old_format" ( + echo Updating old "%user_aliases%" to new format... + type "%user_aliases%.old_format" >> "%user_aliases%" && del "%user_aliases%.old_format" + ) + endlocal ) -:: Update old 'user_aliases' to new self executing 'user_aliases.cmd' -if exist "%CMDER_ROOT%\config\aliases" ( - echo Updating old "%CMDER_ROOT%\config\aliases" to new format... - type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" && del "%CMDER_ROOT%\config\aliases" -) else if exist "%user_aliases%.old_format" ( - echo Updating old "%user_aliases%" to new format... - type "%user_aliases%.old_format" >> "%user_aliases%" && del "%user_aliases%.old_format" -) -endlocal - :: Add aliases to the environment call "%user_aliases%" @@ -288,7 +294,7 @@ call "%user_aliases%" :: Basically we need to execute this post-install.bat because we are :: manually extracting the archive rather than executing the 7z sfx if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - %lib_console% verbose-output "Running Git for Windows one time Post Install...." + %lib_console% verbose_output "Running Git for Windows one time Post Install...." pushd "%GIT_INSTALL_ROOT%\" "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat popd @@ -296,7 +302,7 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( :: Set home path if not defined HOME set "HOME=%USERPROFILE%" -%lib_console% debug-output init.bat "Env Var - HOME=%HOME%" +%lib_console% debug_output init.bat "Env Var - HOME=%HOME%" set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" if exist "%CMDER_ROOT%\config\user_profile.cmd" ( @@ -332,7 +338,8 @@ echo @echo off ) >"%initialConfig%" ) -if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( +echo %comspec% |find /i "tcc.exe">nul +if %errorlevel% == 1 if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd' echo to get rid of this message either: echo. diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index 4de7525..3c174b0 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -13,9 +13,9 @@ if "%~1" == "/h" ( exit /b -:debug-output +:debug_output :::=============================================================================== -:::debug-output - Output a debug message to the console. +:::debug_output - Output a debug message to the console. :::. :::include: :::. @@ -23,22 +23,22 @@ exit /b :::. :::usage: :::. -::: %lib_console% debug-output [caller] [message] +::: %lib_console% debug_output [caller] [message] :::. :::required: :::. -::: [caller] Script/sub routine name calling debug-output +::: [caller] Script/sub routine name calling debug_output :::. ::: [message] Message text to display. :::. :::------------------------------------------------------------------------------- - if %debug-output% gtr 0 echo DEBUG(%~1): %~2 & echo. + if %debug_output% gtr 0 echo DEBUG(%~1): %~2 & echo. exit /b -:verbose-output +:verbose_output :::=============================================================================== -:::verbose-output - Output a debug message to the console. +:::verbose_output - Output a debug message to the console. :::. :::include: :::. @@ -46,7 +46,7 @@ exit /b :::. :::usage: :::. -::: %lib_console% verbose-output "[message]" +::: %lib_console% verbose_output "[message]" :::. :::required: :::. @@ -54,7 +54,7 @@ exit /b :::. :::------------------------------------------------------------------------------- - if %verbose-output% gtr 0 echo %~1 + if %verbose_output% gtr 0 echo %~1 exit /b :show_error diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index d703e58..fc040f0 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -42,11 +42,11 @@ exit /b :: set the executable path set "git_executable=%~2\git.exe" - %lib_console% debug-output :read_version "Env Var - git_executable=%git_executable%" + %lib_console% debug_output :read_version "Env Var - git_executable=%git_executable%" :: check if the executable actually exists if not exist "%git_executable%" ( - %lib_console% debug-output :read_version "%git_executable% does not exist." + %lib_console% debug_output :read_version "%git_executable% does not exist." exit /b -255 ) @@ -54,7 +54,7 @@ exit /b 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" + %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%%C" ) else ( %lib_console% show_error "git --version" returned an inproper version string! pause @@ -124,7 +124,7 @@ exit /b call :parse_version %~1 %~2 :: ... and maybe display it, for debugging purposes. - %lib_console% debug-output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" + %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" exit /b :compare_versions @@ -148,9 +148,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 1d8c9e7..34831b3 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -57,28 +57,28 @@ exit /b set "find_query=%find_query: =\ %" set found=0 - %lib_console% debug-output :enhance_path "Env Var - find_query=%find_query%" + %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!" + %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 - %lib_console% debug-output :enhance_path "Env Var 2 - found=!found!" + %lib_console% debug_output :enhance_path "Env Var 2 - found=!found!" ) if "%found%" == "0" ( - %lib_console% debug-output :enhance_path "BEFORE Env Var - PATH=!path!" + %lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=!path!" if /i "%position%" == "append" ( - %lib_console% debug-output :enhance_path "Appending '%add_path%'" + %lib_console% debug_output :enhance_path "Appending '%add_path%'" set "PATH=%PATH%;%add_path%" ) else ( - %lib_console% debug-output :enhance_path "Prepending '%add_path%'" + %lib_console% debug_output :enhance_path "Prepending '%add_path%'" set "PATH=%add_path%;%PATH%" ) - %lib_console% debug-output :enhance_path "AFTER Env Var - PATH=!path!" + %lib_console% debug_output :enhance_path "AFTER Env Var - PATH=!path!" ) endlocal & set "PATH=%PATH:;;=;%" @@ -134,20 +134,20 @@ exit /b if "%depth%" == "" set depth=0 - %lib_console% debug-output :enhance_path_recursive "Env Var - add_path=%add_path%" - %lib_console% debug-output :enhance_path_recursive "Env Var - position=%position%" - %lib_console% debug-output :enhance_path_recursive "Env Var - max_depth=%max_depth%" + %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%" + %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%" + %lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%" if %max_depth% gtr !depth! ( - %lib_console% debug-output :enhance_path_recursive "Adding parent directory - '%add_path%'" + %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'" call :enhance_path "%add_path%" %position% set /a "depth=!depth!+1" for /d %%i in ("%add_path%\*") do ( - %lib_console% debug-output :enhance_path_recursive "Env Var BEFORE - depth=!depth!" - %lib_console% debug-output :enhance_path_recursive "Found Subdirectory - '%%~fi'" + %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=!depth!" + %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'" call :enhance_path_recursive "%%~fi" %max_depth% %position% - %lib_console% debug-output :enhance_path_recursive "Env Var AFTER- depth=!depth!" + %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=!depth!" ) ) From 352a16f84d28272d57b107603a983fad7999fa82 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 09:04:46 -0500 Subject: [PATCH 027/371] trying to get tcc working --- vendor/init.bat | 30 ++++++++++++++++-------------- vendor/lib/lib_path.cmd | 4 ++-- vendor/lib/lib_profile.cmd | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index ed3a900..22a18f7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -101,8 +101,8 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture_bits=64 ) -echo %comspec% |find /i "tcc.exe">nul -if %errorlevel% == 1 ( +REM echo %comspec% |find /i "tcc.exe">nul +REM if %errorlevel% == 1 ( :: Tell the user about the clink config files... if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" @@ -119,7 +119,7 @@ if %errorlevel% == 1 ( ) else ( "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) -) +REM ) :: Prepare for git-for-windows @@ -134,7 +134,7 @@ 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 :FOUND_GIT ) %lib_console% debug_output init.bat "Looking for Git install root..." @@ -205,7 +205,8 @@ if defined GIT_INSTALL_ROOT ( :: 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" - for /F "delims=" %%F in ('env /usr/bin/locale -uU 2^>nul') do ( + + for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do ( set "LANG=%%F" ) ) @@ -249,15 +250,15 @@ if not defined user_aliases ( ) -echo %comspec% |find /i "tcc.exe">nul -if %errorlevel% == 1 ( - :: The aliases environment variable is used by alias.bat to id - :: the default file to store new aliases in. +echo %comspec% | find /i "tcc.exe">nul +if "%errorlevel%" == "1" ( + REM The aliases environment variable is used by alias.bat to id + REM the default file to store new aliases in. if not defined aliases ( set "aliases=%user_aliases%" ) - :: Make sure we have a self-extracting user_aliases.cmd file + REM Make sure we have a self-extracting user_aliases.cmd file setlocal enabledelayedexpansion if not exist "%user_aliases%" ( echo Creating initial user_aliases store in "%user_aliases%"... @@ -279,10 +280,12 @@ if %errorlevel% == 1 ( :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' if exist "%CMDER_ROOT%\config\aliases" ( echo Updating old "%CMDER_ROOT%\config\aliases" to new format... - type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" && del "%CMDER_ROOT%\config\aliases" + type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" + del "%CMDER_ROOT%\config\aliases" ) else if exist "%user_aliases%.old_format" ( echo Updating old "%user_aliases%" to new format... - type "%user_aliases%.old_format" >> "%user_aliases%" && del "%user_aliases%.old_format" + type "%user_aliases%.old_format" >> "%user_aliases%" + del "%user_aliases%.old_format" ) endlocal ) @@ -337,8 +340,7 @@ echo. echo @echo off ) >"%initialConfig%" ) - -echo %comspec% |find /i "tcc.exe">nul +echo %comspec% | find /i "tcc.exe">nul if %errorlevel% == 1 if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd' echo to get rid of this message either: diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 34831b3..fd63cda 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -58,12 +58,12 @@ exit /b set found=0 %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" - echo "%PATH%"|findstr >nul /I /R ";%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%;" + 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!" ) diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 82dbb4a..98bc9f0 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -39,7 +39,7 @@ exit /b pushd "%~1" for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( - %lib_console% verbose-output "Calling '%~1\%%x'..." + %lib_console% verbose_output "Calling '%~1\%%x'..." call "%~1\%%x" ) popd From 34f8c43d9811408ff0dbbc89d0a6783682e6dea0 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 09:16:40 -0500 Subject: [PATCH 028/371] replace - with _ in debug-output and verbose-output --- vendor/init.bat | 28 ++++++++++++++-------------- vendor/lib/lib_console.cmd | 18 +++++++++--------- vendor/lib/lib_git.cmd | 14 +++++++------- vendor/lib/lib_path.cmd | 32 ++++++++++++++++---------------- vendor/lib/lib_profile.cmd | 2 +- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 7d35a0f..656fc23 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -7,8 +7,8 @@ :: !!! 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. -set verbose-output=0 -set debug-output=0 +set verbose_output=0 +set debug_output=0 set max_depth=1 :: Find root dir @@ -37,9 +37,9 @@ call "%cmder_root%\vendor\lib\lib_profile" if "%~1" == "" ( goto :start ) else if /i "%1"=="/v" ( - set verbose-output=1 + set verbose_output=1 ) else if /i "%1"=="/d" ( - set debug-output=1 + set debug_output=1 ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" @@ -85,11 +85,11 @@ call "%cmder_root%\vendor\lib\lib_profile" goto var_loop :start -%lib_console% debug-output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" -%lib_console% debug-output init.bat "Env Var - debug-output=%debug-output%" +%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" +%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" if defined CMDER_USER_CONFIG ( - %lib_console% debug-output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" + %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" ) :: Pick right version of clink @@ -134,7 +134,7 @@ if defined GIT_INSTALL_ROOT ( if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :FOUND_GIT) ) -%lib_console% debug-output init.bat "Looking for Git install root..." +%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" @@ -165,14 +165,14 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( set test_dir= goto :FOUND_GIT ) else ( - call :verbose-output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... + call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... set test_dir= ) ) else ( :: if the user provided git executable is not found if !errorlevel! equ -255 ( - call :verbose-output No git at "!git_executable!" found. + call :verbose_output No git at "!git_executable!" found. set test_dir= ) @@ -209,8 +209,8 @@ if defined GIT_INSTALL_ROOT ( ) endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug-output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug-output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" +%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" +%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" goto :PATH_ENHANCE :NO_GIT @@ -288,7 +288,7 @@ call "%user_aliases%" :: Basically we need to execute this post-install.bat because we are :: manually extracting the archive rather than executing the 7z sfx if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - %lib_console% verbose-output "Running Git for Windows one time Post Install...." + %lib_console% verbose_output "Running Git for Windows one time Post Install...." pushd "%GIT_INSTALL_ROOT%\" "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat popd @@ -296,7 +296,7 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( :: Set home path if not defined HOME set "HOME=%USERPROFILE%" -%lib_console% debug-output init.bat "Env Var - HOME=%HOME%" +%lib_console% debug_output init.bat "Env Var - HOME=%HOME%" set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" if exist "%CMDER_ROOT%\config\user_profile.cmd" ( diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index 4de7525..3c174b0 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -13,9 +13,9 @@ if "%~1" == "/h" ( exit /b -:debug-output +:debug_output :::=============================================================================== -:::debug-output - Output a debug message to the console. +:::debug_output - Output a debug message to the console. :::. :::include: :::. @@ -23,22 +23,22 @@ exit /b :::. :::usage: :::. -::: %lib_console% debug-output [caller] [message] +::: %lib_console% debug_output [caller] [message] :::. :::required: :::. -::: [caller] Script/sub routine name calling debug-output +::: [caller] Script/sub routine name calling debug_output :::. ::: [message] Message text to display. :::. :::------------------------------------------------------------------------------- - if %debug-output% gtr 0 echo DEBUG(%~1): %~2 & echo. + if %debug_output% gtr 0 echo DEBUG(%~1): %~2 & echo. exit /b -:verbose-output +:verbose_output :::=============================================================================== -:::verbose-output - Output a debug message to the console. +:::verbose_output - Output a debug message to the console. :::. :::include: :::. @@ -46,7 +46,7 @@ exit /b :::. :::usage: :::. -::: %lib_console% verbose-output "[message]" +::: %lib_console% verbose_output "[message]" :::. :::required: :::. @@ -54,7 +54,7 @@ exit /b :::. :::------------------------------------------------------------------------------- - if %verbose-output% gtr 0 echo %~1 + if %verbose_output% gtr 0 echo %~1 exit /b :show_error diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index d703e58..fc040f0 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -42,11 +42,11 @@ exit /b :: set the executable path set "git_executable=%~2\git.exe" - %lib_console% debug-output :read_version "Env Var - git_executable=%git_executable%" + %lib_console% debug_output :read_version "Env Var - git_executable=%git_executable%" :: check if the executable actually exists if not exist "%git_executable%" ( - %lib_console% debug-output :read_version "%git_executable% does not exist." + %lib_console% debug_output :read_version "%git_executable% does not exist." exit /b -255 ) @@ -54,7 +54,7 @@ exit /b 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" + %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%%C" ) else ( %lib_console% show_error "git --version" returned an inproper version string! pause @@ -124,7 +124,7 @@ exit /b call :parse_version %~1 %~2 :: ... and maybe display it, for debugging purposes. - %lib_console% debug-output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" + %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" exit /b :compare_versions @@ -148,9 +148,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 1d8c9e7..fd63cda 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -57,28 +57,28 @@ exit /b 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%\"$" + %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!" + %lib_console% debug_output :enhance_path "Env Var 1 - found=!found!" if "!found!" == "0" ( - echo "%PATH%"|findstr >nul /i /r ";%find_query%;" + 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!" + %lib_console% debug_output :enhance_path "Env Var 2 - found=!found!" ) if "%found%" == "0" ( - %lib_console% debug-output :enhance_path "BEFORE Env Var - PATH=!path!" + %lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=!path!" if /i "%position%" == "append" ( - %lib_console% debug-output :enhance_path "Appending '%add_path%'" + %lib_console% debug_output :enhance_path "Appending '%add_path%'" set "PATH=%PATH%;%add_path%" ) else ( - %lib_console% debug-output :enhance_path "Prepending '%add_path%'" + %lib_console% debug_output :enhance_path "Prepending '%add_path%'" set "PATH=%add_path%;%PATH%" ) - %lib_console% debug-output :enhance_path "AFTER Env Var - PATH=!path!" + %lib_console% debug_output :enhance_path "AFTER Env Var - PATH=!path!" ) endlocal & set "PATH=%PATH:;;=;%" @@ -134,20 +134,20 @@ exit /b if "%depth%" == "" set depth=0 - %lib_console% debug-output :enhance_path_recursive "Env Var - add_path=%add_path%" - %lib_console% debug-output :enhance_path_recursive "Env Var - position=%position%" - %lib_console% debug-output :enhance_path_recursive "Env Var - max_depth=%max_depth%" + %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%" + %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%" + %lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%" if %max_depth% gtr !depth! ( - %lib_console% debug-output :enhance_path_recursive "Adding parent directory - '%add_path%'" + %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'" call :enhance_path "%add_path%" %position% set /a "depth=!depth!+1" for /d %%i in ("%add_path%\*") do ( - %lib_console% debug-output :enhance_path_recursive "Env Var BEFORE - depth=!depth!" - %lib_console% debug-output :enhance_path_recursive "Found Subdirectory - '%%~fi'" + %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=!depth!" + %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'" call :enhance_path_recursive "%%~fi" %max_depth% %position% - %lib_console% debug-output :enhance_path_recursive "Env Var AFTER- depth=!depth!" + %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=!depth!" ) ) diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 82dbb4a..98bc9f0 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -39,7 +39,7 @@ exit /b pushd "%~1" for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( - %lib_console% verbose-output "Calling '%~1\%%x'..." + %lib_console% verbose_output "Calling '%~1\%%x'..." call "%~1\%%x" ) popd From 823e6fee6e042011166288c31116d1b7f70b67cf Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 17:32:20 -0500 Subject: [PATCH 029/371] add cmder_shell method --- vendor/init.bat | 10 +++++----- vendor/lib/lib_base.cmd | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 22a18f7..0ed4668 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -33,6 +33,7 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" + :var_loop if "%~1" == "" ( goto :start @@ -85,6 +86,7 @@ call "%cmder_root%\vendor\lib\lib_profile" goto var_loop :start +%lib_base% cmder_shell %lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" %lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" @@ -101,8 +103,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture_bits=64 ) -REM echo %comspec% |find /i "tcc.exe">nul -REM if %errorlevel% == 1 ( +if "%CMDER_SHELL%" neq "tcc.exe" ( :: Tell the user about the clink config files... if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" @@ -119,7 +120,7 @@ REM if %errorlevel% == 1 ( ) else ( "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) -REM ) +) :: Prepare for git-for-windows @@ -250,8 +251,7 @@ if not defined user_aliases ( ) -echo %comspec% | find /i "tcc.exe">nul -if "%errorlevel%" == "1" ( +if "%CMDER_SHELL%" neq "tcc.exe" ( REM The aliases environment variable is used by alias.bat to id REM the default file to store new aliases in. if not defined aliases ( diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 37a1072..6c2954a 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -43,3 +43,24 @@ exit /b pause exit /b + +:cmder_shell +:::=============================================================================== +:::show_subs - shows all sub routines in a .bat/.cmd file with documentation +:::. +:::include: +:::. +::: call "lib_base.cmd" +:::. +:::usage: +:::. +::: %lib_base% is_cmd +:::. +:::options: +:::. +::: file full path to file containing lib_routines to display +:::. +:::------------------------------------------------------------------------------- + echo %comspec% | find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd.exe" + echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc.exe" + exit /b From 823eeaf08227c0ec6fdaa8ed053c52f7c94faf1f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 18:18:59 -0500 Subject: [PATCH 030/371] cmder_shell settings --- vendor/init.bat | 33 ++++++++++++++++----------------- vendor/lib/lib_base.cmd | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 0ed4668..274f73b 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -33,7 +33,6 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" - :var_loop if "%~1" == "" ( goto :start @@ -86,6 +85,7 @@ call "%cmder_root%\vendor\lib\lib_profile" goto var_loop :start +:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES %lib_base% cmder_shell %lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" %lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" @@ -103,22 +103,22 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture_bits=64 ) -if "%CMDER_SHELL%" neq "tcc.exe" ( - :: Tell the user about the clink config files... - if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( - echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" - echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ - - ) else if not exist "%CMDER_ROOT%\config\settings" ( - echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" - echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. - ) +if "%CMDER_CLINK%" == "1" ( + %lib_console% verbose_output "Injecting Clink..." :: Run clink if defined CMDER_USER_CONFIG ( - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" + if not exist "%CMDER_USER_CONFIG%\settings" ( + echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" + echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ + ) + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" ) else ( - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" + if not exist "%CMDER_ROOT%\config\settings" ( + echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" + echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. + ) + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) ) @@ -250,8 +250,7 @@ if not defined user_aliases ( ) ) - -if "%CMDER_SHELL%" neq "tcc.exe" ( +if "%CMDER_ALIASES%" == "1" ( REM The aliases environment variable is used by alias.bat to id REM the default file to store new aliases in. if not defined aliases ( @@ -340,8 +339,8 @@ echo. echo @echo off ) >"%initialConfig%" ) -echo %comspec% | find /i "tcc.exe">nul -if %errorlevel% == 1 if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( + +if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd' echo to get rid of this message either: echo. diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 6c2954a..5c9a9af 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -61,6 +61,16 @@ exit /b ::: file full path to file containing lib_routines to display :::. :::------------------------------------------------------------------------------- - echo %comspec% | find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd.exe" - echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc.exe" + echo %comspec% | find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd" + echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" + echo %comspec% | find /i "\tccle" > nul && set "CMDER_SHELL=tccle" + + set CMDER_CLINK=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 + + set CMDER_ALIASES=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 + exit /b From 3f963366102c705f70bfb460c190638359c2a87f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 18:53:49 -0500 Subject: [PATCH 031/371] verbos output --- vendor/init.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 274f73b..313b923 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -104,7 +104,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( ) if "%CMDER_CLINK%" == "1" ( - %lib_console% verbose_output "Injecting Clink..." + %lib_console% verbose_output "Injecting Clink!" :: Run clink if defined CMDER_USER_CONFIG ( @@ -120,6 +120,8 @@ if "%CMDER_CLINK%" == "1" ( ) "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) +) else ( + %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" ) :: Prepare for git-for-windows From 85c4a5b4aff6a7110c4d6b992410b7901234821e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 18:56:17 -0500 Subject: [PATCH 032/371] cleanup --- vendor/lib/lib_base.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 5c9a9af..8577637 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -54,7 +54,7 @@ exit /b :::. :::usage: :::. -::: %lib_base% is_cmd +::: %lib_base% cmder_shell :::. :::options: :::. @@ -68,7 +68,7 @@ exit /b set CMDER_CLINK=1 if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 - + set CMDER_ALIASES=1 if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 From 9869f9a3723aa2fd6cfdb10463a78231acd8eb98 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 18:59:14 -0500 Subject: [PATCH 033/371] cleanup --- vendor/init.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 313b923..b10028e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -258,7 +258,7 @@ if "%CMDER_ALIASES%" == "1" ( if not defined aliases ( set "aliases=%user_aliases%" ) - + REM Make sure we have a self-extracting user_aliases.cmd file setlocal enabledelayedexpansion if not exist "%user_aliases%" ( @@ -277,7 +277,7 @@ if "%CMDER_ALIASES%" == "1" ( ) ) ) - + :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' if exist "%CMDER_ROOT%\config\aliases" ( echo Updating old "%CMDER_ROOT%\config\aliases" to new format... @@ -352,7 +352,7 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD echo. echo If you have customized it and want to continue using it instead of the included version echo * Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd'. - echo * Search for 'user-aliases' and replace it with 'user_aliases'. + echo * Search for 'user-aliases' and replace it with 'user_aliases'. ) set initialConfig= From 44b4b7a1954c49b6aec67794aaf7a0e26672f71b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 19:09:12 -0500 Subject: [PATCH 034/371] '.gitignore' --- .gitignore | 1 + vendor/bin/alias.cmd | 131 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 vendor/bin/alias.cmd diff --git a/.gitignore b/.gitignore index bb66d82..a19ca87 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ ## Those files should be taken from their repositary vendor/*/* +!vendor/bin/* !vendor/lib/* !vendor/* !vendor/psmodules/PsGet diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd new file mode 100644 index 0000000..50e22e7 --- /dev/null +++ b/vendor/bin/alias.cmd @@ -0,0 +1,131 @@ +@echo off + + +if "%ALIASES%" == "" ( + set ALIASES="%CMDER_ROOT%\config\user_aliases.cmd" +) + +setlocal enabledelayedexpansion + +if "%~1" == "" echo Use /? for help & echo. & goto :p_show + +:: check command usage + +rem #region parseargument +goto parseargument + +:do_shift + shift + +:parseargument + set currentarg=%~1 + + if /i "%currentarg%" equ "/f" ( + set ALIASES=%~2 + shift + goto :do_shift + ) else if /i "%currentarg%" == "/reload" ( + goto :p_reload + ) else if "%currentarg%" equ "/?" ( + goto :p_help + ) else if /i "%currentarg%" equ "/d" ( + if "%~2" neq "" ( + if "%~3" equ "" ( + :: /d flag for delete existing alias + call :p_del %~2 + shift + goto :eof + ) + ) + ) else if "%currentarg%" neq "" ( + if "%~2" equ "" ( + :: Show the specified alias + doskey /macros | findstr /b %currentarg%= && exit /b + echo insufficient parameters. + goto :p_help + ) else ( + :: handle quotes within command definition, e.g. quoted long file names + set _x=%* + ) + ) +rem #endregion parseargument + +if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( + set _x=!_x:/f "%ALIASES%" =! + + if not exist "%ALIASES%" ( + echo ;= @echo off>"%ALIASES%" + echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%" + echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%" + echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%" + echo ;= goto:eof>>"%ALIASES%" + echo ;= Add aliases below here>>"%ALIASES%" + ) +) + +:: validate alias +for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( + set alias_name=%%G + set alias_value=%%H +) + +:: leading quotes added while validating +set alias_name=%alias_name:~1% + +:: trailing quotes added while validating +set alias_value=%alias_value:~0,-1% + +::remove spaces +set _temp=%alias_name: =% + +if not ["%_temp%"] == ["%alias_name%"] ( + echo Your alias name can not contain a space + endlocal + exit /b +) + +:: replace already defined alias +findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" +echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" +doskey /macrofile="%ALIASES%" +endlocal +exit /b + +:p_del +set del_alias=%~1 +findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" +type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" +doskey %del_alias%= +doskey /macrofile="%ALIASES%" +goto:eof + +:p_reload +doskey /macrofile="%ALIASES%" +echo Aliases reloaded +exit /b + +:p_show +doskey /macros|findstr /v /r "^;=" | sort +exit /b + +:p_help +echo.Usage: +echo. +echo. alias [options] [alias=full command] +echo. +echo.Options: +echo. +echo. /d [alias] Delete an [alias]. +echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. +echo. Default: %cmder_root%\config\user_aliases.cmd +echo. /reload Reload the aliases file. Can be used with /f argument. +echo. Default: %cmder_root%\config\user_aliases.cmd +echo. +echo. If alias is called with no parameters, it will display the list of existing aliases. +echo. +echo. In the command, you can use the following notations: +echo. $* allows the alias to assume all the parameters of the supplied command. +echo. $1-$9 Allows you to seperate parameter by number, much like %%1 in batch. +echo. $T is the command seperator, allowing you to string several commands together into one alias. +echo. For more information, read DOSKEY/? +exit /b From d58c6c207061c762a7429a440792468ea7406eab Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Sep 2018 19:17:16 -0500 Subject: [PATCH 035/371] cleanup --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index b10028e..fb82d2d 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -62,11 +62,11 @@ call "%cmder_root%\vendor\lib\lib_profile" shift ) ) else if /i "%1" == "/git_install_root" ( - if exist "%2\cmd\git.exe" ( + if exist "%2" ( set "GIT_INSTALL_ROOT=%~2" shift ) else ( - %lib_console% show_error "The Git install root folder "%~2\cmd\git.exe", you specified does not exist!" + %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" exit /b ) ) else if /i "%1" == "/home" ( From 12b9af99c542ae086ab16270f47612b0c1a6ea0b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Sep 2018 06:05:20 -0500 Subject: [PATCH 036/371] '.gitignore' --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a19ca87..3243549 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ ## Those files should be taken from their repositary +bin/*/* +!bin/Readme.md vendor/*/* !vendor/bin/* !vendor/lib/* @@ -23,4 +25,3 @@ config/profile.d .github_changelog_generator launcher/.vs launcher/src/version.rc2 -!bin/Readme.md From ec4c815264696c7862b391dbac85578cd73c4506 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Sep 2018 06:08:44 -0500 Subject: [PATCH 037/371] cleanup --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index fb82d2d..d19a75f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -62,7 +62,7 @@ call "%cmder_root%\vendor\lib\lib_profile" shift ) ) else if /i "%1" == "/git_install_root" ( - if exist "%2" ( + if exist "%~2" ( set "GIT_INSTALL_ROOT=%~2" shift ) else ( From b1aa687d4ff4e57cd6f508925e1ef07a854851dd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Sep 2018 11:06:39 -0500 Subject: [PATCH 038/371] handle start dir args with trailing \" --- launcher/src/CmderLauncher.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6ca5015..7bd1b21 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -422,6 +422,7 @@ cmderOptions GetOption() for (int i = 1; i < argCount; i++) { + // MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK); if (_wcsicmp(L"/c", szArgList[i]) == 0) @@ -441,6 +442,12 @@ cmderOptions GetOption() } else if (_wcsicmp(L"/start", szArgList[i]) == 0) { + int len = wcslen(szArgList[i + 1]); + if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0) + { + szArgList[i + 1][len - 1] = '\0'; + } + if (PathFileExists(szArgList[i + 1])) { cmderOptions.cmderStart = szArgList[i + 1]; @@ -476,7 +483,7 @@ cmderOptions GetOption() { cmderOptions.unRegisterApp = true; cmderOptions.registerApp = false; - if (szArgList[i + 1] != NULL) + if (szArgList[i + 1] != NULL) { if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0) { @@ -485,9 +492,22 @@ cmderOptions GetOption() } } } - else if (cmderOptions.cmderStart == L"" && PathFileExists(szArgList[i])) + else if (cmderOptions.cmderStart == L"") { - cmderOptions.cmderStart = szArgList[i]; + int len = wcslen(szArgList[i]); + if (wcscmp(&szArgList[i][len - 1], L"\"") == 0) + { + szArgList[i][len - 1] = '\0'; + } + + if (PathFileExists(szArgList[i])) + { + cmderOptions.cmderStart = szArgList[i]; + i++; + } + else { + MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); + } } else { MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); From 277972a7f25f9cd0ae022d2f86237b6f022889da Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Sep 2018 12:59:43 -0400 Subject: [PATCH 039/371] fixed --- vendor/init.bat | 5 +++++ vendor/lib/lib_path.cmd | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index d19a75f..fc06547 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -95,6 +95,8 @@ if defined CMDER_USER_CONFIG ( ) :: Pick right version of clink +echo here + if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture=86 set architecture_bits=32 @@ -223,6 +225,7 @@ goto :PATH_ENHANCE :: Skip this if GIT WAS FOUND else we did 'endlocal' above! endlocal +echo here2 :PATH_ENHANCE %lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% @@ -356,4 +359,6 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD ) set initialConfig= + + exit /b diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index fd63cda..0b478d4 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -58,12 +58,12 @@ exit /b set found=0 %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" - echo %path%|findstr >nul /I /R ";%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%;" + 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!" ) From 7b191d3caf48fc287ec9f54580984ac7d608bf51 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 3 Sep 2018 14:54:52 -0500 Subject: [PATCH 040/371] cleanup --- vendor/init.bat | 3 --- 1 file changed, 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index fc06547..3b05d34 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -95,8 +95,6 @@ if defined CMDER_USER_CONFIG ( ) :: Pick right version of clink -echo here - if "%PROCESSOR_ARCHITECTURE%"=="x86" ( set architecture=86 set architecture_bits=32 @@ -225,7 +223,6 @@ goto :PATH_ENHANCE :: Skip this if GIT WAS FOUND else we did 'endlocal' above! endlocal -echo here2 :PATH_ENHANCE %lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% From bd9cff2691f2f7ef810429b1de02652c29b2b69d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 5 Sep 2018 18:07:27 -0500 Subject: [PATCH 041/371] cleanup --- vendor/init.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 3b05d34..a689bde 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -357,5 +357,4 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD set initialConfig= - exit /b From ab0de6d15794ae96c34a98273a849ae8af654239 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Thu, 13 Sep 2018 17:58:29 +0200 Subject: [PATCH 042/371] :arrow_up: Update Git to 2.19.0 Release notes: https://github.com/git-for-windows/git/releases/tag/v2.19.0.windows.1 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 437a4ee..2076b96 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.17.1.windows.2", - "url": "https://github.com/git-for-windows/git/releases/download/v2.17.1.windows.2/PortableGit-2.17.1.2-64-bit.7z.exe" + "version": "v2.19.0.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.19.0.windows.1/PortableGit-2.19.0-64-bit.7z.exe" }, { "name": "clink", From 2cfa7c45fc84cebf0b8094bf124f0a082d5434af Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Thu, 13 Sep 2018 18:05:36 +0200 Subject: [PATCH 043/371] :arrow_up: ConEmu to 180626 release notes: https://conemu.github.io/en/Whats_New.html --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 2076b96..72696ce 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -11,8 +11,8 @@ }, { "name": "conemu-maximus5", - "version": "180528", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v18.05.28/ConEmuPack.180528.7z" + "version": "180626", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v18.06.26/ConEmuPack.180626.7z" }, { "name": "clink-completions", From 669e99760261b02968fc43e7793b9e2661e78186 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 12:52:23 -0500 Subject: [PATCH 044/371] flag_exists.cmd to flag_exec.cmd, also to lib as an option --- .../flag_exists.cmd => bin/flag_exec.cmd} | 0 vendor/lib/lib_profile.cmd | 131 ++++++++++++++++++ 2 files changed, 131 insertions(+) rename vendor/{lib/flag_exists.cmd => bin/flag_exec.cmd} (100%) diff --git a/vendor/lib/flag_exists.cmd b/vendor/bin/flag_exec.cmd similarity index 100% rename from vendor/lib/flag_exists.cmd rename to vendor/bin/flag_exec.cmd diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 98bc9f0..55fe62c 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -44,3 +44,134 @@ exit /b ) popd exit /b + +:flag_exec + @echo off + setlocal + + if "%~1" equ "" call :wrongSyntax + + if not defined CMDER_USER_FLAGS ( + :: in case nothing was passed to %CMDER_USER_FLAGS% + set "CMDER_USER_FLAGS= " + ) + + set "feNot=false" + goto :parseArgument + + :doShift + shift + + :parseArgument + set "currenArgu=%~1" + if /i "%currenArgu%" equ "/setPath" ( + :: set %flag_exists% shortcut + endlocal + set "flag_exists=%~dp0flag_exists" + ) else if /i "%currenArgu%" == "/?" ( + call :help + ) else if /i "%currenArgu%" equ "/help" ( + call :help + ) else if /i "%currenArgu%" equ "/h" ( + call :help + ) else if /i "%currenArgu%" equ "NOT" ( + set "feNot=true" + goto :doShift + ) else ( + if "%~1" equ "" call :wrongSyntax + if "%~2" equ "" call :wrongSyntax + set "feFlagName=%~1" + set "feCommand=%~2" + if not "%~3" equ "" ( + set "feParam=%~3" + ) + ) + + :: to avoid erroneous deteciton like "/do" "/doNOT", which both have a "/do" + :: we added a space after the flag name, like "/do ", which won't match "/doN" + set "feFlagName=%feFlagName% " + :: echo. + :: echo %CMDER_USER_FLAGS% + :: echo %feNOT% + :: echo %feFlagName% + :: echo %feCommand% + :: echo %feParam% + :: echo. + echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul + if "%ERRORLEVEL%" == "0" ( + if "%feNOT%" == "false" ( + call %feCommand% %feParam% + ) + ) else ( + if "%feNOT%" == "true" ( + call %feCommand% %feParam% + ) + ) + endlocal + exit /b + + :wrongSyntax + echo The syntax of the command is incorrect. + echo. + echo use /? for help + echo. + endlocal + exit /b + + :help + echo. + echo %%flag_exists%% + echo. + echo Handles with custom arguments for cmder's init.bat. + echo written by xiazeyu, inspired DRSDavidSoft. + echo. + echo Usage: + echo. + echo %%flag_exists%% [/setPath] [NOT] flagName command/program [parameters] + echo. + echo setPath Generate a global varible %%flag_exists%% for + echo quicker use. Following arguments will be ignored. + echo. + echo NOT Specifies that %%flag_exists%% should carry out + echo the command only if the flag is missing. + echo. + echo flagName Specifies which flag name is to detect. It's recommand + echo to use a pair of double quotation marks to wrap + echo your flag name to avoid exceed expectation. + echo. + echo command/program Specifies the command to carry out if the + echo argument name is detected. It's recommand to + echo use a pair of double quotation marks to + echo wrap your command to avoid exceed expectation. + echo. + echo parameters These are the parameters passed to the command/program. + echo It's recommand to use a pair of double quotation marks + echo to wrap your flag name to avoid exceed expectation. + echo. + echo Examples: + echo. + echo these examples are expected to be writted in /config/user-profile.cmd + echo it will use the environment varible "CMDER_USER_FLAGS" + echo. + echo Case 1: + echo. + echo The following command in user-profile.cmd would execute "notepad.exe" + echo. + echo call %%flag_exists%% "/startNotepad" "start" "notepad.exe" + echo. + echo if you pass parameter to init.bat like: + echo. + echo init.bat /startNotepad + echo. + echo Case 2: + echo. + echo The following command in user-profile.cmd would execute "notepad.exe" + echo. + echo call %%flag_exists%% NOT "/dontStartNotepad" "start" "notepad.exe" + echo. + echo UNLESS you pass parameter to init.bat like: + echo. + echo init.bat /dontStartNotepad + echo. + endlocal + exit /b From 9dce9d0f62ca0546347bd490a95722db2eedc92d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 13:55:54 -0500 Subject: [PATCH 045/371] added exit codes --- README.md | 8 +++---- vendor/bin/{flag_exec.cmd => cexec.cmd} | 30 ++++++++++++++----------- vendor/init.bat | 1 + 3 files changed, 22 insertions(+), 17 deletions(-) rename vendor/bin/{flag_exec.cmd => cexec.cmd} (77%) diff --git a/README.md b/README.md index d50c61f..9e8e711 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ | `/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-liases.cmd` | | `/v` | Enables verbose output. | not set | -| (custom arguments) | User defined arguments processed by `flag_exists`. Type `%flag_exists% /?` for more useage. | 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: @@ -249,7 +249,7 @@ Uncomment and edit the below line in the script to use Cmder config even when la ### Handling with custom arguments when using init.bat -You can pass custom arguments to `init.bat` and use `%flag_exists%` to detect it. +You can pass custom arguments to `init.bat` and use `cexec` to detect it. It is useful when you have multiple modes to execute cmder. @@ -265,7 +265,7 @@ to start init.bat with custom argument(`/startNotepad`) and put ```batch -call %flag_exists% "/startNotepad" "start" "notepad.exe"` +call cexec "/startNotepad" "start" "notepad.exe"` ``` @@ -279,7 +279,7 @@ init.bat the `notepad.exe` won't be executed. -To see detailed usage of `%flag_exists%`, type `%flag_exists% /?` in cmder. +To see detailed usage of `cexec`, type `cexec /?` in cmder. ### Integrating Cmder with [Hyper](https://github.com/zeit/hyper), [Microsoft VS Code](https://code.visualstudio.com/), and your favorite IDEs diff --git a/vendor/bin/flag_exec.cmd b/vendor/bin/cexec.cmd similarity index 77% rename from vendor/bin/flag_exec.cmd rename to vendor/bin/cexec.cmd index c144340..2b1c09f 100644 --- a/vendor/bin/flag_exec.cmd +++ b/vendor/bin/cexec.cmd @@ -19,9 +19,10 @@ set "currenArgu=%~1" if /i "%currenArgu%" equ "/setPath" ( :: set %flag_exists% shortcut endlocal - set "flag_exists=%~dp0flag_exists" + set "ccall=call %~dp0cexec.cmd" + set "cexec=%~dp0cexec.cmd" ) else if /i "%currenArgu%" == "/?" ( - goto :help + call :help ) else if /i "%currenArgu%" equ "/help" ( goto :help ) else if /i "%currenArgu%" equ "/h" ( @@ -55,14 +56,16 @@ echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul if "%ERRORLEVEL%" == "0" ( if "%feNOT%" == "false" ( call %feCommand% %feParam% + exit /b 0 ) ) else ( if "%feNOT%" == "true" ( call %feCommand% %feParam% + exit /b 0 ) ) endlocal -exit /b +exit /b 1 :wrongSyntax echo The syntax of the command is incorrect. @@ -74,22 +77,22 @@ exit /b :help echo. -echo %%flag_exists%% +echo CExec - Conditional Exec echo. echo Handles with custom arguments for cmder's init.bat. echo written by xiazeyu, inspired DRSDavidSoft. echo. echo Usage: echo. -echo %%flag_exists%% [/setPath] [NOT] flagName command/program [parameters] +echo cexec [NOT] flagName command/program [parameters] echo. -echo setPath Generate a global varible %%flag_exists%% for +echo /setPath Generate a global varible %%cexec%% for echo quicker use. Following arguments will be ignored. echo. -echo NOT Specifies that %%flag_exists%% should carry out +echo NOT Specifies that cexec should carry out echo the command only if the flag is missing. echo. -echo flagName Specifies which flag name is to detect. It's recommand +echo /[flagName] Specifies which flag name is to detect. It's recommand echo to use a pair of double quotation marks to wrap echo your flag name to avoid exceed expectation. echo. @@ -104,16 +107,17 @@ echo to wrap your flag name to avoid exceed expectation. echo. echo Examples: echo. -echo these examples are expected to be writted in /config/user-profile.cmd -echo it will use the environment varible "CMDER_USER_FLAGS" +echo These examples are expected to be written in %cmder_root%/config/user-profile.cmd +echo CExec evaluates the environment varible "CMDER_USER_FLAGS" and conditionally +echo caries out actions based on flags that are passed. echo. echo Case 1: echo. echo The following command in user-profile.cmd would execute "notepad.exe" echo. -echo call %%flag_exists%% "/startNotepad" "start" "notepad.exe" +echo call cexec "/startNotepad" "start" "notepad.exe" echo. -echo if you pass parameter to init.bat like: +echo If you pass parameter to init.bat like: echo. echo init.bat /startNotepad echo. @@ -121,7 +125,7 @@ echo Case 2: echo. echo The following command in user-profile.cmd would execute "notepad.exe" echo. -echo call %%flag_exists%% NOT "/dontStartNotepad" "start" "notepad.exe" +echo call cexec NOT "/dontStartNotepad" "start" "notepad.exe" echo. echo UNLESS you pass parameter to init.bat like: echo. diff --git a/vendor/init.bat b/vendor/init.bat index f2f3880..6690c40 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -29,6 +29,7 @@ if not defined CMDER_ROOT ( :: Remove trailing '\' from %CMDER_ROOT% if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%" +call "%cmder_root%\vendor\bin\cexec.cmd" /setpath call "%cmder_root%\vendor\lib\lib_base" call "%cmder_root%\vendor\lib\lib_path" call "%cmder_root%\vendor\lib\lib_console" From 0be94725bd8b138b9e3635e2eb1fb2cc4e8e75fb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 15:06:13 -0500 Subject: [PATCH 046/371] readme.md --- README.md | 52 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 9e8e711..a0548f7 100644 --- a/README.md +++ b/README.md @@ -247,37 +247,51 @@ Uncomment and edit the below line in the script to use Cmder config even when la # CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. ``` -### Handling with custom arguments when using init.bat +### Customizing user sessions using `init.bat` custom arguments. -You can pass custom arguments to `init.bat` and use `cexec` to detect it. +You can pass custom arguments to `init.bat` and use `cexec` in your `user_profile.cmd` to evaluate these +arguments then execute commands based on a particular flag being detected or not. -It is useful when you have multiple modes to execute cmder. +`init.bat` creates two shortcuts for using `cexec` in your profile scripts. -If you use + Evaluate flags, runs commands if found, and returns to the calling script and continues. -```batch + ``` + ccall=call C:\Users\user\cmderdev\vendor\bin\cexec.cmd + ``` -init.bat /startNotepad + Example: `%ccall% /startnotepad start notepad.exe` + + Evaluate flags, runs commands if found, and does not return to the calling script. -``` + ``` + cexec=C:\Users\user\cmderdev\vendor\bin\cexec.cmd + ``` + + Example: `%cexec% /startnotepad start notepad.exe` -to start init.bat with custom argument(`/startNotepad`) and put +It is useful when you have multiple tasks to execute `cmder` and need it to initialize +the session differently depending on the task chosen. -```batch +To conditionally start `notepad.exe` when you start a specific `cmder` task: -call cexec "/startNotepad" "start" "notepad.exe"` +* Press win+alt+t +* Click `+` to add a new task. +* Add the below to the `Commands` block: -``` + ```batch + + cmd.exe /k ""%ConEmuDir%\..\init.bat" /startnotepad" + + ``` -into `/config/user-profile.cmd`, then `notepad.exe` will be executed, and once you use +* Add the below to your `%cmder_root%\config\user_profile.cmd` -```batch - -init.bat - -``` - -the `notepad.exe` won't be executed. + ```batch + + %ccall% "/startNotepad" "start" "notepad.exe"` + + ``` To see detailed usage of `cexec`, type `cexec /?` in cmder. From 4aec21ce199c1eb11370cbb6c09a10e2c48ae6e0 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 15:10:35 -0500 Subject: [PATCH 047/371] readme.md --- vendor/bin/cexec.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index 2b1c09f..fc0ac47 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -22,7 +22,7 @@ if /i "%currenArgu%" equ "/setPath" ( set "ccall=call %~dp0cexec.cmd" set "cexec=%~dp0cexec.cmd" ) else if /i "%currenArgu%" == "/?" ( - call :help + goto :help ) else if /i "%currenArgu%" equ "/help" ( goto :help ) else if /i "%currenArgu%" equ "/h" ( From 86544c91886d956d6ff07df18daf070c524c1ee1 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 15:11:50 -0500 Subject: [PATCH 048/371] readme.md --- vendor/bin/cexec.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index fc0ac47..b4bb81e 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -84,7 +84,7 @@ echo written by xiazeyu, inspired DRSDavidSoft. echo. echo Usage: echo. -echo cexec [NOT] flagName command/program [parameters] +echo cexec /setPath [NOT] flagName command/program [parameters] echo. echo /setPath Generate a global varible %%cexec%% for echo quicker use. Following arguments will be ignored. From f84da84e15201aaf121cea8de3322834d58da85c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 15:12:45 -0500 Subject: [PATCH 049/371] cleanup --- vendor/lib/lib_profile.cmd | 130 ------------------------------------- 1 file changed, 130 deletions(-) diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 55fe62c..9bf08b9 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -45,133 +45,3 @@ exit /b popd exit /b -:flag_exec - @echo off - setlocal - - if "%~1" equ "" call :wrongSyntax - - if not defined CMDER_USER_FLAGS ( - :: in case nothing was passed to %CMDER_USER_FLAGS% - set "CMDER_USER_FLAGS= " - ) - - set "feNot=false" - goto :parseArgument - - :doShift - shift - - :parseArgument - set "currenArgu=%~1" - if /i "%currenArgu%" equ "/setPath" ( - :: set %flag_exists% shortcut - endlocal - set "flag_exists=%~dp0flag_exists" - ) else if /i "%currenArgu%" == "/?" ( - call :help - ) else if /i "%currenArgu%" equ "/help" ( - call :help - ) else if /i "%currenArgu%" equ "/h" ( - call :help - ) else if /i "%currenArgu%" equ "NOT" ( - set "feNot=true" - goto :doShift - ) else ( - if "%~1" equ "" call :wrongSyntax - if "%~2" equ "" call :wrongSyntax - set "feFlagName=%~1" - set "feCommand=%~2" - if not "%~3" equ "" ( - set "feParam=%~3" - ) - ) - - :: to avoid erroneous deteciton like "/do" "/doNOT", which both have a "/do" - :: we added a space after the flag name, like "/do ", which won't match "/doN" - set "feFlagName=%feFlagName% " - :: echo. - :: echo %CMDER_USER_FLAGS% - :: echo %feNOT% - :: echo %feFlagName% - :: echo %feCommand% - :: echo %feParam% - :: echo. - echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul - if "%ERRORLEVEL%" == "0" ( - if "%feNOT%" == "false" ( - call %feCommand% %feParam% - ) - ) else ( - if "%feNOT%" == "true" ( - call %feCommand% %feParam% - ) - ) - endlocal - exit /b - - :wrongSyntax - echo The syntax of the command is incorrect. - echo. - echo use /? for help - echo. - endlocal - exit /b - - :help - echo. - echo %%flag_exists%% - echo. - echo Handles with custom arguments for cmder's init.bat. - echo written by xiazeyu, inspired DRSDavidSoft. - echo. - echo Usage: - echo. - echo %%flag_exists%% [/setPath] [NOT] flagName command/program [parameters] - echo. - echo setPath Generate a global varible %%flag_exists%% for - echo quicker use. Following arguments will be ignored. - echo. - echo NOT Specifies that %%flag_exists%% should carry out - echo the command only if the flag is missing. - echo. - echo flagName Specifies which flag name is to detect. It's recommand - echo to use a pair of double quotation marks to wrap - echo your flag name to avoid exceed expectation. - echo. - echo command/program Specifies the command to carry out if the - echo argument name is detected. It's recommand to - echo use a pair of double quotation marks to - echo wrap your command to avoid exceed expectation. - echo. - echo parameters These are the parameters passed to the command/program. - echo It's recommand to use a pair of double quotation marks - echo to wrap your flag name to avoid exceed expectation. - echo. - echo Examples: - echo. - echo these examples are expected to be writted in /config/user-profile.cmd - echo it will use the environment varible "CMDER_USER_FLAGS" - echo. - echo Case 1: - echo. - echo The following command in user-profile.cmd would execute "notepad.exe" - echo. - echo call %%flag_exists%% "/startNotepad" "start" "notepad.exe" - echo. - echo if you pass parameter to init.bat like: - echo. - echo init.bat /startNotepad - echo. - echo Case 2: - echo. - echo The following command in user-profile.cmd would execute "notepad.exe" - echo. - echo call %%flag_exists%% NOT "/dontStartNotepad" "start" "notepad.exe" - echo. - echo UNLESS you pass parameter to init.bat like: - echo. - echo init.bat /dontStartNotepad - echo. - endlocal - exit /b From 564ef5220e168893899ac1e6f25fba6a455ae065 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 15 Sep 2018 16:25:31 -0500 Subject: [PATCH 050/371] allow conditionally setting environment variables --- vendor/bin/cexec.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index b4bb81e..2efcacd 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -55,12 +55,12 @@ set "feFlagName=%feFlagName% " echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul if "%ERRORLEVEL%" == "0" ( if "%feNOT%" == "false" ( - call %feCommand% %feParam% + endlocal && call %feCommand% %feParam% exit /b 0 ) ) else ( if "%feNOT%" == "true" ( - call %feCommand% %feParam% + endlocal && call %feCommand% %feParam% exit /b 0 ) ) From 1d36ba4ed4a8850b57f2718a2e858423735b67c5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 16 Sep 2018 10:18:10 -0500 Subject: [PATCH 051/371] fix user lua and git detection --- vendor/clink.lua | 26 ++++++-------------------- vendor/init.bat | 20 ++++++++++++++++---- vendor/lib/lib_git.cmd | 14 ++++++++------ vendor/lib/lib_path.cmd | 18 +++++++++++------- 4 files changed, 41 insertions(+), 37 deletions(-) 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!" ) From 8cf59d1cbf7a63f7da2d73c41a3ad3be5808dce7 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 16 Sep 2018 10:21:37 -0500 Subject: [PATCH 052/371] cleanup --- vendor/init.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index a745914..e3b9b6e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -7,7 +7,6 @@ :: !!! 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 From 749ce17dbe873161d4ccc264ef80feda99f1af4e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 16 Sep 2018 15:53:49 -0500 Subject: [PATCH 053/371] git prompt yellow --- vendor/clink.lua | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 0b2c6be..3e7c6d7 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -222,6 +222,21 @@ local function get_git_status() return true end +--- +-- Gets the conflict status +-- @return {bool} indicating true for conflict, false for no conflicts +--- +function get_git_conflict() + local file = io.popen("git diff --name-only --diff-filter=U 2>nul") + for line in file:lines() do + file:close() + return true; + end + file:close() + return false +end + + --- -- Get the status of working dir -- @return {bool} @@ -257,7 +272,8 @@ local function git_prompt_filter() -- Colors for git status local colors = { clean = "\x1b[1;37;40m", - dirty = "\x1b[31;1m", + dirty = "\x1b[33;3m", + conflict = "\x1b[31;1m" } local git_dir = get_git_dir() @@ -267,12 +283,18 @@ local function git_prompt_filter() local color if branch then -- Has branch => therefore it is a git folder, now figure out status - if get_git_status() then + local gitStatus = get_git_status() + local gitConflict = get_git_conflict() + + color = colors.dirty + if gitStatus then color = colors.clean - else - color = colors.dirty end + if gitConflict then + color = colors.conflict + end + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..branch..")") return false end From bda09bc274b93ba26990d5b490a014184668dae8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 16 Sep 2018 16:23:22 -0500 Subject: [PATCH 054/371] init.bat update for cexec --- vendor/init.bat | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 6690c40..9365bd9 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -7,7 +7,6 @@ :: !!! 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 @@ -333,10 +332,6 @@ if not exist "%initialConfig%" ( echo :: use this file to run your own startup commands echo :: use in front of the command to prevent printing the command echo. -echo :: the next two lines is for "%%flag_exists%%" shortcut, a custom arguments handler -echo :: don't remove it if you need it -echo call "%%cmder_root%%/vendor/lib/flag_exists" "/setPath" -echo. echo :: uncomment this to have the ssh agent load when cmder starts echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd" echo. @@ -348,9 +343,9 @@ echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so: -echo :: more useage can be seen by typing "%%flag_exists%% /?" +echo :: more useage can be seen by typing "cexec /?" echo. -echo :: %%flag_exists%% "/customOption" "command/program" +echo :: %%ccall%% "/customOption" "command/program" echo. echo @echo off ) >"%initialConfig%" From bb4ed4af51fd0dd1f7953f1a8989c9aee58ec1c0 Mon Sep 17 00:00:00 2001 From: gaoslin <40920884+gaoslin@users.noreply.github.com> Date: Tue, 18 Sep 2018 17:26:11 +0800 Subject: [PATCH 055/371] Update init.bat --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index e3b9b6e..2b1ae5f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -210,9 +210,9 @@ if defined GIT_INSTALL_ROOT ( rem add the unix commands at the end to not shadow windows commands like more if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" append if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32" append + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" append ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64" append + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" append ) %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append From 8dc9bc9ae1e2525eeaa5d672faa0870e6949e19e Mon Sep 17 00:00:00 2001 From: leochien0102 Date: Fri, 21 Sep 2018 16:01:52 +0800 Subject: [PATCH 056/371] fix the 'was unexpected at this time.' Change the single quotation marks to double while path concerned --- vendor/init.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index e3b9b6e..1b42969 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -353,15 +353,15 @@ echo @echo off ) if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( - echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd' + echo Cmder's 'alias' command has been moved into "%CMDER_ROOT%\vendor\bin\alias.cmd" echo to get rid of this message either: echo. - echo Delete the file '%CMDER_ROOT%\bin\alias.bat' + echo Delete the file "%CMDER_ROOT%\bin\alias.bat" echo. echo or echo. echo If you have customized it and want to continue using it instead of the included version - echo * Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd'. + echo * Rename "%CMDER_ROOT%\bin\alias.bat" to "%CMDER_ROOT%\bin\alias.cmd". echo * Search for 'user-aliases' and replace it with 'user_aliases'. ) From 103d0a6cea871d10c3df992861b833c155c6fbb2 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 24 Sep 2018 18:51:55 -0500 Subject: [PATCH 057/371] more headers --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a0548f7..15e7267 100644 --- a/README.md +++ b/README.md @@ -249,26 +249,26 @@ Uncomment and edit the below line in the script to use Cmder config even when la ### Customizing user sessions using `init.bat` custom arguments. -You can pass custom arguments to `init.bat` and use `cexec` in your `user_profile.cmd` to evaluate these +You can pass custom arguments to `init.bat` and use `cexec.cmd` in your `user_profile.cmd` to evaluate these arguments then execute commands based on a particular flag being detected or not. -`init.bat` creates two shortcuts for using `cexec` in your profile scripts. +`init.bat` creates two shortcuts for using `cexec.cmd` in your profile scripts. - Evaluate flags, runs commands if found, and returns to the calling script and continues. +#### `%ccall%` - Evaluates flags, runs commands if found, and returns to the calling script and continues. - ``` - ccall=call C:\Users\user\cmderdev\vendor\bin\cexec.cmd - ``` +``` +ccall=call C:\Users\user\cmderdev\vendor\bin\cexec.cmd +``` - Example: `%ccall% /startnotepad start notepad.exe` - - Evaluate flags, runs commands if found, and does not return to the calling script. +Example: `%ccall% /startnotepad start notepad.exe` - ``` - cexec=C:\Users\user\cmderdev\vendor\bin\cexec.cmd - ``` - - Example: `%cexec% /startnotepad start notepad.exe` +#### `%cexec%` - Evaluates flags, runs commands if found, and does not return to the calling script. + +``` +cexec=C:\Users\user\cmderdev\vendor\bin\cexec.cmd +``` + +Example: `%cexec% /startnotepad start notepad.exe` It is useful when you have multiple tasks to execute `cmder` and need it to initialize the session differently depending on the task chosen. From 8ff459b309cbcd10314041eb8296679925b0a785 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 24 Sep 2018 19:07:48 -0500 Subject: [PATCH 058/371] fixes --- vendor/bin/cexec.cmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index 2efcacd..3193f4f 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -86,7 +86,7 @@ echo Usage: echo. echo cexec /setPath [NOT] flagName command/program [parameters] echo. -echo /setPath Generate a global varible %%cexec%% for +echo /setPath Generate a global varibles %%ccall%% and %%cexec%% for echo quicker use. Following arguments will be ignored. echo. echo NOT Specifies that cexec should carry out @@ -113,9 +113,9 @@ echo caries out actions based on flags that are passed. echo. echo Case 1: echo. -echo The following command in user-profile.cmd would execute "notepad.exe" +echo The following command in `user_profile.cmd` would execute "notepad.exe" and continue running the `user_profile.cmd` echo. -echo call cexec "/startNotepad" "start" "notepad.exe" +echo "%ccall%" "/startNotepad" "start" "notepad.exe" echo. echo If you pass parameter to init.bat like: echo. @@ -123,9 +123,9 @@ echo init.bat /startNotepad echo. echo Case 2: echo. -echo The following command in user-profile.cmd would execute "notepad.exe" +echo The following command in `user_profile.cmd` would execute "notepad.exe" and stop running the `user_profile.cmd` echo. -echo call cexec NOT "/dontStartNotepad" "start" "notepad.exe" +echo "%cexec%" NOT "/dontStartNotepad" "start" "notepad.exe" echo. echo UNLESS you pass parameter to init.bat like: echo. From a607f0f2d53eb620436ac0cc248458a402a6dfed Mon Sep 17 00:00:00 2001 From: Nicolas Arnaud-Cormos Date: Wed, 10 Oct 2018 07:11:58 +0200 Subject: [PATCH 059/371] Ensure the right git path is found in case of shim. If the git found is a shim, we need to follow the path to the actual git directory to set the GIT_INSTALL_ROOT variable. This happens when installing git via scoop for example. --- vendor/init.bat | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 1be7569..fab4411 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -154,7 +154,16 @@ if defined GIT_INSTALL_ROOT ( for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :: get the absolute path to the user provided git binary pushd %%~dpF - set "test_dir=!CD!" + :: check if there's shim - and if yes follow the path + if exist git.shim ( + for /F "tokens=2 delims== " %%I in (git.shim) do ( + pushd %%~dpI + set "test_dir=!CD!" + popd + ) + ) else ( + set "test_dir=!CD!" + ) popd :: get the version information for the user provided git binary From 3a11d45552ae0b6688af82c6466cda09f5946d9e Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Fri, 2 Nov 2018 09:00:41 -0400 Subject: [PATCH 060/371] add diag helper scripts and adds to the path (#1918) These scripts are to help us help our users by getting a relative picture of their environment that they can submit with an incident. --- vendor/bin/cmder_diag.cmd | 41 +++++++++++++++++++++++++++++++++++++++ vendor/bin/cmder_diag.ps1 | 39 +++++++++++++++++++++++++++++++++++++ vendor/bin/cmder_diag.sh | 39 +++++++++++++++++++++++++++++++++++++ vendor/bin/timer.cmd | 22 +++++++++++++++++++++ vendor/cmder.sh | 4 +++- vendor/cmder_exinit | 4 +++- vendor/init.bat | 9 +++++++++ vendor/profile.ps1 | 4 +++- 8 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 vendor/bin/cmder_diag.cmd create mode 100644 vendor/bin/cmder_diag.ps1 create mode 100644 vendor/bin/cmder_diag.sh create mode 100644 vendor/bin/timer.cmd diff --git a/vendor/bin/cmder_diag.cmd b/vendor/bin/cmder_diag.cmd new file mode 100644 index 0000000..9476512 --- /dev/null +++ b/vendor/bin/cmder_diag.cmd @@ -0,0 +1,41 @@ +@echo off + +echo ------------------------------------ +echo dir "%cmder_root%" +echo ------------------------------------ +dir "%cmder_root%" + +echo. +echo ------------------------------------ +echo dir "%cmder_root%\vendor" +echo ------------------------------------ +dir "%cmder_root%\vendor" + +echo. +echo ------------------------------------ +echo dir /s "%cmder_root%\bin" +echo ------------------------------------ +dir /s "%cmder_root%\bin" + +echo. +echo ------------------------------------ +echo dir /s "%cmder_root%\config" +echo ------------------------------------ +dir /s "%cmder_root%\config" + +echo. +echo ------------------------------------ +echo set +echo ------------------------------------ +set + +echo. +echo ------------------------------------ +echo where git +echo ------------------------------------ +where git + +echo. +echo ------------------------------------ +echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! +echo ------------------------------------ diff --git a/vendor/bin/cmder_diag.ps1 b/vendor/bin/cmder_diag.ps1 new file mode 100644 index 0000000..54ac8f6 --- /dev/null +++ b/vendor/bin/cmder_diag.ps1 @@ -0,0 +1,39 @@ +write-host ------------------------------------ +write-host get-childitem "$env:CMDER_ROOT" +write-host ------------------------------------ +get-childitem "$env:CMDER_ROOT" + +write-host '' +write-host ------------------------------------ +write-host get-childitem "$env:CMDER_ROOT/vendor" +write-host ------------------------------------ +get-childitem "$env:CMDER_ROOT/vendor" + +write-host '' +write-host ------------------------------------ +write-host get-childitem -s "$env:CMDER_ROOT/bin" +write-host ------------------------------------ +get-childitem -s "$env:CMDER_ROOT/bin" + +write-host '' +write-host ------------------------------------ +write-host get-childitem -s "$env:CMDER_ROOT/config" +write-host ------------------------------------ +get-childitem -s "$env:CMDER_ROOT/config" + +write-host '' +write-host ------------------------------------ +write-host get-childitem env: +write-host ------------------------------------ +get-childitem env: |ft -autosize -wrap + +write-host '' +write-host ------------------------------------ +write-host get-command git +write-host ------------------------------------ +get-command git + +write-host '' +write-host ------------------------------------ +write-host Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! +write-host ------------------------------------ diff --git a/vendor/bin/cmder_diag.sh b/vendor/bin/cmder_diag.sh new file mode 100644 index 0000000..1630933 --- /dev/null +++ b/vendor/bin/cmder_diag.sh @@ -0,0 +1,39 @@ +echo ------------------------------------ +echo ls -la "$CMDER_ROOT" +echo ------------------------------------ +ls -la "$CMDER_ROOT" + +echo '' +echo ------------------------------------ +echo ls -la "$CMDER_ROOT/vendor" +echo ------------------------------------ +ls -la "$CMDER_ROOT/vendor" + +echo '' +echo ------------------------------------ +echo ls -la /s "$CMDER_ROOT/bin" +echo ------------------------------------ +ls -laR /s "$CMDER_ROOT/bin" + +echo '' +echo ------------------------------------ +echo ls -la /s "$CMDER_ROOT/config" +echo ------------------------------------ +ls -laR /s "$CMDER_ROOT/config" + +echo '' +echo ------------------------------------ +echo env +echo ------------------------------------ +env + +echo '' +echo ------------------------------------ +echo which git +echo ------------------------------------ +which git + +echo '' +echo ------------------------------------ +echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! +echo ------------------------------------ diff --git a/vendor/bin/timer.cmd b/vendor/bin/timer.cmd new file mode 100644 index 0000000..e0b8424 --- /dev/null +++ b/vendor/bin/timer.cmd @@ -0,0 +1,22 @@ +@echo off + +set start=%~1 +set end=%~2 + +set options="tokens=1-4 delims=:.," +for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100 +for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100 + +set /a hours=%end_h%-%start_h% +set /a mins=%end_m%-%start_m% +set /a secs=%end_s%-%start_s% +set /a ms=%end_ms%-%start_ms% +if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms% +if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs% +if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins% +if %hours% lss 0 set /a hours = 24%hours% +if 1%ms% lss 100 set ms=0%ms% + +:: Mission accomplished +set /a totalsecs = %hours%*3600 + %mins%*60 + %secs% +echo Elapsed Time: %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index aa59642..a0ab173 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -45,7 +45,7 @@ if [[ ! "$PATH" =~ "${GIT_INSTALL_ROOT}/bin:" ]] ; then PATH=${GIT_INSTALL_ROOT}/bin:$PATH fi -PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} +PATH=${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT} export PATH @@ -80,6 +80,8 @@ if [ "${CMDER_USER_CONFIG}" != "" ] ; then mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" fi + export PATH=${CMDER_USER_CONFIG}/bin:$PATH + CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then . "${CMDER_USER_CONFIG}/user_profile.sh" diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index c182aee..bab6f20 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -63,7 +63,7 @@ if [ ! "$CMDER_ROOT" = "" ] ; then export CMDER_ROOT - PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} + PATH=${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT} export PATH @@ -98,6 +98,8 @@ if [ ! "$CMDER_ROOT" = "" ] ; then mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" fi + export PATH=${CMDER_USER_CONFIG}/bin:$PATH + CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then . "${CMDER_USER_CONFIG}/user_profile.sh" diff --git a/vendor/init.bat b/vendor/init.bat index fab4411..1c8c080 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -1,5 +1,7 @@ @echo off +set cmder_init_start=%time% + :: Init Script for cmd.exe :: Created as part of cmder project @@ -38,6 +40,8 @@ call "%cmder_root%\vendor\lib\lib_profile" :var_loop if "%~1" == "" ( goto :start + ) else if /i "%1"=="/t" ( + set time_init=1 ) else if /i "%1"=="/v" ( set verbose_output=1 ) else if /i "%1"=="/d" ( @@ -386,4 +390,9 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD set initialConfig= set CMDER_CONFIGURED=1 +set cmder_init_end=%time% + +if %time_init% gtr 0 ( + %cmder_root%\vendor\bin\timer.cmd %cmder_init_start% %cmder_init_end% +) exit /b diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 8c9f207..19cff9a 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -93,7 +93,7 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { } # Enhance Path -$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT" +$env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT" # # Prompt Section @@ -166,6 +166,8 @@ if ($ENV:CMDER_USER_CONFIG) { rename-item "$env:CMDER_USER_CONFIG\user-profile.ps1" user_profile.ps1 } + $env:Path = "$Env:CMDER_USER_CONFIG\bin;$env:Path" + $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1" if (Test-Path $CmderUserProfilePath) { Import-Module "$CmderUserProfilePath" From da0aea96f8ae30d21a7babbccde64f1171788b83 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Fri, 2 Nov 2018 18:32:28 +0100 Subject: [PATCH 061/371] Fix typo and broken link --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 758a57c..816d1e4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ If you follow them your contribution will likely be pulled in quicker. ## Making Changes -* Make changes in your seperate branch. +* Make changes in your separate branch. * Check for unnecessary whitespace with `git diff --check` before committing. * Make sure your commit messages are easy to understand * Squash your 'Correcting mistakes' commits if you have a lot of them. (See the 'Squashing Commits' link below) @@ -35,4 +35,4 @@ If you follow them your contribution will likely be pulled in quicker. * [Squashing Commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) * [General GitHub documentation](http://help.github.com/) -* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) +* [GitHub pull request documentation](http://help.github.com/articles/creating-a-pull-request/) From f5ac81daa0c91fc690f84f7ccd1764945164800b Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Fri, 2 Nov 2018 18:37:13 +0100 Subject: [PATCH 062/371] Fix typos, remove escaping inside inline code, replace single quote with backtick --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 15e7267..ec47ec2 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ You can open multiple tabs each containing one of the following shells: | Task | Shell | Description | | ---- | ----- | ----------- | | Cmder | `cmd.exe` | Windows `cmd.exe` shell enhanced with Git, Git aware prompt, Clink (GNU Readline), and Aliases. | -| Cmder as Admin | `cmd.exe` | Administrative Windows 'cmd.exe' Cmder shell. | +| Cmder as Admin | `cmd.exe` | Administrative Windows `cmd.exe` Cmder shell. | | PowerShell | `powershell.exe` | Windows PowerShell enhanced with Git and Git aware prompt . | | PowerShell as Admin | `powershell.exe` | Administrative Windows `powershell.exe` Cmder shell. | | Bash | `bash.exe` | Unix/Linux like bash shell running on Windows. | @@ -101,7 +101,7 @@ You can open multiple tabs each containing one of the following shells: Cmder, PowerShell, and Bash tabs all run on top of the Windows Console API and work as you might expect in Cmder with access to use ConEmu's color schemes, key bindings and other settings defined in the ConEmu Settings dialog. -⚠ *NOTE:* Only the full edition of Cmder comes with a pre-installed bash, using a vendored [git-for-windows](https://gitforwindows.org/) installation. The pre-configured Bash tabs may not work on Cmder mini eidition without additional configuration. +⚠ *NOTE:* Only the full edition of Cmder comes with a pre-installed bash, using a vendored [git-for-windows](https://gitforwindows.org/) installation. The pre-configured Bash tabs may not work on Cmder mini edition without additional configuration. You may however, choose to use an external installation of bash, such as Microsoft's [Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) (called WSL) or the [Cygwin](https://cygwin.com/) project which provides POSIX support on windows. @@ -128,7 +128,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ 1. Click either: * `1. {cmd::Cmder as Admin}` * `2. {cmd::Cmder}` -1. Add command line argumentswhere specified below: +1. Add command line arguments where specified below: *Note: Pay attention to the quotes!* @@ -146,7 +146,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ | `/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-liases.cmd` | +| `/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 | @@ -155,8 +155,8 @@ Single user portable configuration is possible using the cmder specific shell co | Shell | Cmder Portable User Config | | ------------- | ----------------------------------------- | -| Cmder | `%CMDER_ROOT%\\config\\user_profile.cmd` | -| PowerShell | `$ENV:CMDER_ROOT\\config\\user_profile.ps1` | +| Cmder | `%CMDER_ROOT%\config\user_profile.cmd` | +| PowerShell | `$ENV:CMDER_ROOT\config\user_profile.ps1` | | Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` | Note: Bash and Mintty sessions will also source the `$HOME/.bashrc` file if it exists after it sources `$CMDER_ROOT/config/user_profile.sh`. @@ -165,15 +165,15 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t | Shell | Cmder `Profile.d` Scripts | | ------------- | --------------------------------------------------| -| Cmder | `%CMDER_ROOT%\\config\\profile.d\\\*.bat and *.cmd` | -| PowerShell | `$ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1` | +| Cmder | `%CMDER_ROOT%\config\profile.d\*.bat and *.cmd` | +| PowerShell | `$ENV:CMDER_ROOT\config\profile.d\*.ps1` | | Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` | ### Aliases #### Cmder(`Cmd.exe`) Aliases You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. -Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for 'cmd.exe' +Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for `cmd.exe` Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\user-aliases.cmd` file @@ -181,9 +181,9 @@ To make an alias and/or any other profile settings permanent add it to one of th Note: These are loaded in this order by `$CMDER_ROOT/vendor/init.bat`. Anything stored in `%CMDER_ROOT%` will be a portable setting and will follow cmder to another machine. -* `%CMDER_ROOT%\\config\\profile.d\\\*.cmd` and `\*.bat` -* `%CMDER_ROOT%\\config\\user-aliases.cmd` -* `%CMDER_ROOT%\\config\\user_profile.cmd` +* `%CMDER_ROOT%\config\profile.d\*.cmd` and `\*.bat` +* `%CMDER_ROOT%\config\user-aliases.cmd` +* `%CMDER_ROOT%\config\user_profile.cmd` #### Bash.exe|Mintty.exe Aliases Bash shells support simple and complex aliases with optional parameters natively so they work a little different. Typing `alias name=command` will create an alias only for the current running session. @@ -203,10 +203,10 @@ PowerShell has native simple alias support, for example `[new-alias | set-alias] To make an alias and/or any other profile settings permanent add it to one of the following: -Note: These are loaded in this order by `$ENV:CMDER_ROOT\\vendor\\user_profile.ps1`. Anything stored in `$ENV:CMDER_ROOT` will be a portable setting and will follow cmder to another machine. +Note: These are loaded in this order by `$ENV:CMDER_ROOT\vendor\user_profile.ps1`. Anything stored in `$ENV:CMDER_ROOT` will be a portable setting and will follow cmder to another machine. -* '$ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1' -* '$ENV:CMDER_ROOT\\config\\user_profile.ps1' +* `$ENV:CMDER_ROOT\config\profile.d\*.ps1` +* `$ENV:CMDER_ROOT\config\user_profile.ps1` ### SSH Agent From cb78f0486a7aad46904508c8427d44fa71518c53 Mon Sep 17 00:00:00 2001 From: Merlin Date: Tue, 30 Oct 2018 15:22:39 +0100 Subject: [PATCH 063/371] Remove duplicate `Install-Module` detection Block was inserted twice. --- vendor/profile.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 19cff9a..995b745 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -29,10 +29,6 @@ $ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\")) # -> recent PowerShell versions include PowerShellGet out of the box $moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null) -# do not load bundled psget if a module installer is already available -# -> recent PowerShell versions include PowerShellGet out of the box -$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null) - # Add Cmder modules directory to the autoload path. $CmderModulePath = Join-path $PSScriptRoot "psmodules/" From 5be25f29f8b0f1a8dc08de596ccc9859f496752d Mon Sep 17 00:00:00 2001 From: Gregory Lucas Date: Sat, 3 Nov 2018 10:19:34 -0400 Subject: [PATCH 064/371] Initialize time_init to fix init error message --- vendor/init.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/init.bat b/vendor/init.bat index 1c8c080..e57627d 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -11,6 +11,7 @@ set cmder_init_start=%time% :: Use /v command line arg or set to > 0 for verbose output to aid in debugging. set verbose_output=0 set debug_output=0 +set time_init=0 set max_depth=1 set "CMDER_USER_FLAGS= " From a5bdecca771e9eec79f6c583fc8eca1777afdfc2 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 3 Nov 2018 20:36:51 -0400 Subject: [PATCH 065/371] 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) --- README.md | 23 ++++++++++++----------- vendor/init.bat | 11 +++++++++-- vendor/lib/lib_console.cmd | 2 +- vendor/lib/lib_git.cmd | 2 -- vendor/lib/lib_path.cmd | 17 ++++++++++++++++- vendor/lib/lib_profile.cmd | 1 - 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index ec47ec2..b56c05b 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/vendor/init.bat b/vendor/init.bat index e57627d..57c7b35 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -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= " @@ -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 @@ -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..." @@ -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 diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index 3c174b0..17540dd 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -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" diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 2e7f60e..bfbcdb2 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -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 "" ( diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index d59c44d..b1a6d2d 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -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 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 diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 9bf08b9..32bb77a 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -1,6 +1,5 @@ @echo off - call "%~dp0lib_base.cmd" call "%%~dp0lib_console" set lib_profile=call "%~dp0lib_profile.cmd" From 57e5ae1719d6b23ccaf5517c3d0de21c7ca3033d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 8 Nov 2018 21:25:42 -0500 Subject: [PATCH 066/371] move default comemu.xml to vendor folder --- .gitignore | 1 + launcher/src/CmderLauncher.cpp | 92 +++++++++++++------ .../ConEmu.xml => vendor/ConEmu.xml.default | 0 3 files changed, 67 insertions(+), 26 deletions(-) rename config/ConEmu.xml => vendor/ConEmu.xml.default (100%) diff --git a/.gitignore b/.gitignore index 3243549..4b38da8 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ config/*.lua config/settings config/aliases config/profile.d +config/conemu-*.xml .github_changelog_generator launcher/.vs launcher/src/version.rc2 diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 7bd1b21..6d81411 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -110,8 +110,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(configDirPath, exeDir, L"config"); + /* + Convert legacy user-profile.cmd to new name user_profile.cmd + */ PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) { + if (PathFileExists(legacyUserProfilePath)) + { PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -124,8 +128,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + /* + Convert legacy user-aliases.cmd to new name user_aliases.cmd + */ PathCombine(legacyUserAliasesPath, configDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) { + if (PathFileExists(legacyUserAliasesPath)) + { PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -137,13 +145,18 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr userAliasesPath, (size_t)MAX_PATH); rename(lPr, pR); } - + + /* + Was -c [path] specified? + */ if (wcscmp(userConfigDirPath, L"") == 0) { + // No - It wasn't. PathCombine(userConfigDirPath, exeDir, L"config"); } else { + // Yes - It was. PathCombine(userBinDirPath, userConfigDirPath, L"bin"); SHCreateDirectoryEx(0, userBinDirPath, 0); @@ -152,9 +165,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); - + + /* + Convert legacy user-profile.cmd to new name user_profile.cmd + */ PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) { + if (PathFileExists(legacyUserProfilePath)) + { PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -167,8 +184,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + /* + Convert legacy user-aliases.cmd to new name user_aliases.cmd + */ PathCombine(legacyUserAliasesPath, userConfigDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) { + if (PathFileExists(legacyUserAliasesPath)) + { PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -186,15 +207,19 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml"); // Set path to Cmder default ConEmu config file - PathCombine(defaultCfgPath, exeDir, L"config\\ConEmu.xml"); + PathCombine(defaultCfgPath, exeDir, L"config\\vendor\\ConEmu.xml.default"); // Check for machine-specific then user config source file. PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); + // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) { - if (PathFileExists(cfgPath)) { + + if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. + { + if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. + { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { MessageBox(NULL, @@ -204,7 +229,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else + else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { @@ -216,8 +241,10 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(userCfgPath)) { - if (PathFileExists(cfgPath)) { + else if (PathFileExists(userCfgPath)) // If config/user_conemu.xml exists use it. + { + if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. + { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -227,7 +254,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else + else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml { if (!CopyFile(userCfgPath, cfgPath, FALSE)) { @@ -239,7 +266,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(cfgPath)) { + else if (PathFileExists(cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml + { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -249,7 +277,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else { + else // No previous conemu.xml config exists use the default. + { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { MessageBox(NULL, @@ -262,28 +291,34 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } - else { + else + { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } if (is_single_mode) { - if (!streqi(cmderTask.c_str(), L"")) { + if (!streqi(cmderTask.c_str(), L"")) + { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else { + else + { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } else { - if (!streqi(cmderTask.c_str(), L"")) { + if (!streqi(cmderTask.c_str(), L"")) + { swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else { + else + { swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } @@ -435,7 +470,8 @@ cmderOptions GetOption() cmderOptions.cmderCfgRoot = cmderCfgRoot; - if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') { + if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') + { cmderOptions.cmderCfgRoot = szArgList[i + 1]; i++; } @@ -453,7 +489,8 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i + 1]; i++; } - else { + else + { MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } @@ -505,11 +542,13 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i]; i++; } - else { + else + { MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); } } - else { + else + { MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } @@ -531,7 +570,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); - if (cmderOptions.registerApp == true) { + if (cmderOptions.registerApp == true) + { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); } diff --git a/config/ConEmu.xml b/vendor/ConEmu.xml.default similarity index 100% rename from config/ConEmu.xml rename to vendor/ConEmu.xml.default From f3ed7b6d1b07a20b21569bde95634f04c98c50e9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 8 Nov 2018 21:35:23 -0500 Subject: [PATCH 067/371] ignore all of config folder --- .gitignore | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 4b38da8..a975d46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,26 @@ ## Those files should be taken from their repositary +bin/* bin/*/* !bin/Readme.md + vendor/*/* !vendor/bin/* !vendor/lib/* !vendor/* !vendor/psmodules/PsGet -config/.history +config/* +config/*/* +!config/Readme.md + Thumbs.db *.exe *.dll build/ Version v* *.bak -config/user-* -config/user_* -config/*.lua -config/settings -config/aliases -config/profile.d -config/conemu-*.xml .github_changelog_generator launcher/.vs launcher/src/version.rc2 From ce62db6d33117cf985982b62f8959535898ee3ff Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 8 Nov 2018 21:45:21 -0500 Subject: [PATCH 068/371] cleanup --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index a975d46..ac64e10 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ ## Those files should be taken from their repositary bin/* -bin/*/* !bin/Readme.md vendor/*/* @@ -12,7 +11,6 @@ vendor/*/* !vendor/psmodules/PsGet config/* -config/*/* !config/Readme.md Thumbs.db From 637b0fd3acf1554818cc5ac34bfaf006bffcffcc Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Fri, 9 Nov 2018 20:40:16 -0500 Subject: [PATCH 069/371] Ignore `%cmder_root%\config` (#1945) * move default comemu.xml to vendor folder * ignore all of config folder * cleanup --- .gitignore | 13 +-- launcher/src/CmderLauncher.cpp | 92 +++++++++++++------ .../ConEmu.xml => vendor/ConEmu.xml.default | 0 3 files changed, 71 insertions(+), 34 deletions(-) rename config/ConEmu.xml => vendor/ConEmu.xml.default (100%) diff --git a/.gitignore b/.gitignore index 3243549..ac64e10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,24 @@ ## Those files should be taken from their repositary -bin/*/* +bin/* !bin/Readme.md + vendor/*/* !vendor/bin/* !vendor/lib/* !vendor/* !vendor/psmodules/PsGet -config/.history +config/* +!config/Readme.md + Thumbs.db *.exe *.dll build/ Version v* *.bak -config/user-* -config/user_* -config/*.lua -config/settings -config/aliases -config/profile.d .github_changelog_generator launcher/.vs launcher/src/version.rc2 diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 7bd1b21..6d81411 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -110,8 +110,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(configDirPath, exeDir, L"config"); + /* + Convert legacy user-profile.cmd to new name user_profile.cmd + */ PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) { + if (PathFileExists(legacyUserProfilePath)) + { PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -124,8 +128,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + /* + Convert legacy user-aliases.cmd to new name user_aliases.cmd + */ PathCombine(legacyUserAliasesPath, configDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) { + if (PathFileExists(legacyUserAliasesPath)) + { PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -137,13 +145,18 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr userAliasesPath, (size_t)MAX_PATH); rename(lPr, pR); } - + + /* + Was -c [path] specified? + */ if (wcscmp(userConfigDirPath, L"") == 0) { + // No - It wasn't. PathCombine(userConfigDirPath, exeDir, L"config"); } else { + // Yes - It was. PathCombine(userBinDirPath, userConfigDirPath, L"bin"); SHCreateDirectoryEx(0, userBinDirPath, 0); @@ -152,9 +165,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); - + + /* + Convert legacy user-profile.cmd to new name user_profile.cmd + */ PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) { + if (PathFileExists(legacyUserProfilePath)) + { PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -167,8 +184,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } + /* + Convert legacy user-aliases.cmd to new name user_aliases.cmd + */ PathCombine(legacyUserAliasesPath, userConfigDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) { + if (PathFileExists(legacyUserAliasesPath)) + { PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -186,15 +207,19 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml"); // Set path to Cmder default ConEmu config file - PathCombine(defaultCfgPath, exeDir, L"config\\ConEmu.xml"); + PathCombine(defaultCfgPath, exeDir, L"config\\vendor\\ConEmu.xml.default"); // Check for machine-specific then user config source file. PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); + // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) { - if (PathFileExists(cfgPath)) { + + if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. + { + if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. + { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { MessageBox(NULL, @@ -204,7 +229,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else + else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { @@ -216,8 +241,10 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(userCfgPath)) { - if (PathFileExists(cfgPath)) { + else if (PathFileExists(userCfgPath)) // If config/user_conemu.xml exists use it. + { + if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. + { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -227,7 +254,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else + else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml { if (!CopyFile(userCfgPath, cfgPath, FALSE)) { @@ -239,7 +266,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(cfgPath)) { + else if (PathFileExists(cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml + { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -249,7 +277,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else { + else // No previous conemu.xml config exists use the default. + { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { MessageBox(NULL, @@ -262,28 +291,34 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } - else { + else + { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } if (is_single_mode) { - if (!streqi(cmderTask.c_str(), L"")) { + if (!streqi(cmderTask.c_str(), L"")) + { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else { + else + { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } else { - if (!streqi(cmderTask.c_str(), L"")) { + if (!streqi(cmderTask.c_str(), L"")) + { swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else { + else + { swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } @@ -435,7 +470,8 @@ cmderOptions GetOption() cmderOptions.cmderCfgRoot = cmderCfgRoot; - if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') { + if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') + { cmderOptions.cmderCfgRoot = szArgList[i + 1]; i++; } @@ -453,7 +489,8 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i + 1]; i++; } - else { + else + { MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } @@ -505,11 +542,13 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i]; i++; } - else { + else + { MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); } } - else { + else + { MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } @@ -531,7 +570,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); - if (cmderOptions.registerApp == true) { + if (cmderOptions.registerApp == true) + { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); } diff --git a/config/ConEmu.xml b/vendor/ConEmu.xml.default similarity index 100% rename from config/ConEmu.xml rename to vendor/ConEmu.xml.default From 72b676b939053267234995622119293ff5c05092 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 10 Nov 2018 06:42:27 -0500 Subject: [PATCH 070/371] Revert "Ignore `%cmder_root%\config` (#1945)" This reverts commit 637b0fd3acf1554818cc5ac34bfaf006bffcffcc. --- .gitignore | 13 ++- .../ConEmu.xml.default => config/ConEmu.xml | 0 launcher/src/CmderLauncher.cpp | 92 ++++++------------- 3 files changed, 34 insertions(+), 71 deletions(-) rename vendor/ConEmu.xml.default => config/ConEmu.xml (100%) diff --git a/.gitignore b/.gitignore index ac64e10..3243549 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,27 @@ ## Those files should be taken from their repositary -bin/* +bin/*/* !bin/Readme.md - vendor/*/* !vendor/bin/* !vendor/lib/* !vendor/* !vendor/psmodules/PsGet -config/* -!config/Readme.md - +config/.history Thumbs.db *.exe *.dll build/ Version v* *.bak +config/user-* +config/user_* +config/*.lua +config/settings +config/aliases +config/profile.d .github_changelog_generator launcher/.vs launcher/src/version.rc2 diff --git a/vendor/ConEmu.xml.default b/config/ConEmu.xml similarity index 100% rename from vendor/ConEmu.xml.default rename to config/ConEmu.xml diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6d81411..7bd1b21 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -110,12 +110,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(configDirPath, exeDir, L"config"); - /* - Convert legacy user-profile.cmd to new name user_profile.cmd - */ PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) - { + if (PathFileExists(legacyUserProfilePath)) { PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -128,12 +124,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } - /* - Convert legacy user-aliases.cmd to new name user_aliases.cmd - */ PathCombine(legacyUserAliasesPath, configDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) - { + if (PathFileExists(legacyUserAliasesPath)) { PathCombine(userAliasesPath, configDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -145,18 +137,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr userAliasesPath, (size_t)MAX_PATH); rename(lPr, pR); } - - /* - Was -c [path] specified? - */ + if (wcscmp(userConfigDirPath, L"") == 0) { - // No - It wasn't. PathCombine(userConfigDirPath, exeDir, L"config"); } else { - // Yes - It was. PathCombine(userBinDirPath, userConfigDirPath, L"bin"); SHCreateDirectoryEx(0, userBinDirPath, 0); @@ -165,13 +152,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); - - /* - Convert legacy user-profile.cmd to new name user_profile.cmd - */ + PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); - if (PathFileExists(legacyUserProfilePath)) - { + if (PathFileExists(legacyUserProfilePath)) { PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -184,12 +167,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr rename(lPr, pR); } - /* - Convert legacy user-aliases.cmd to new name user_aliases.cmd - */ PathCombine(legacyUserAliasesPath, userConfigDirPath, L"user-aliases.cmd"); - if (PathFileExists(legacyUserAliasesPath)) - { + if (PathFileExists(legacyUserAliasesPath)) { PathCombine(userAliasesPath, userConfigDirPath, L"user_aliases.cmd"); char *lPr = (char *)malloc(MAX_PATH); @@ -207,19 +186,15 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml"); // Set path to Cmder default ConEmu config file - PathCombine(defaultCfgPath, exeDir, L"config\\vendor\\ConEmu.xml.default"); + PathCombine(defaultCfgPath, exeDir, L"config\\ConEmu.xml"); // Check for machine-specific then user config source file. PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); - // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - - if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. - { - if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. - { + if (PathFileExists(cpuCfgPath)) { + if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { MessageBox(NULL, @@ -229,7 +204,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file + else { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { @@ -241,10 +216,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(userCfgPath)) // If config/user_conemu.xml exists use it. - { - if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. - { + else if (PathFileExists(userCfgPath)) { + if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -254,7 +227,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml + else { if (!CopyFile(userCfgPath, cfgPath, FALSE)) { @@ -266,8 +239,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else if (PathFileExists(cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml - { + else if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, @@ -277,8 +249,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr exit(1); } } - else // No previous conemu.xml config exists use the default. - { + else { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { MessageBox(NULL, @@ -291,34 +262,28 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr SYSTEM_INFO sysInfo; GetNativeSystemInfo(&sysInfo); - if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - { + if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu64.exe"); } - else - { + else { PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } if (is_single_mode) { - if (!streqi(cmderTask.c_str(), L"")) - { + if (!streqi(cmderTask.c_str(), L"")) { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else - { + else { swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } else { - if (!streqi(cmderTask.c_str(), L"")) - { + if (!streqi(cmderTask.c_str(), L"")) { swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str()); } - else - { + else { swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); } } @@ -470,8 +435,7 @@ cmderOptions GetOption() cmderOptions.cmderCfgRoot = cmderCfgRoot; - if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') - { + if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') { cmderOptions.cmderCfgRoot = szArgList[i + 1]; i++; } @@ -489,8 +453,7 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i + 1]; i++; } - else - { + else { MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } @@ -542,13 +505,11 @@ cmderOptions GetOption() cmderOptions.cmderStart = szArgList[i]; i++; } - else - { + else { MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); } } - else - { + else { MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } @@ -570,8 +531,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, cmderOptions cmderOptions = GetOption(); - if (cmderOptions.registerApp == true) - { + if (cmderOptions.registerApp == true) { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); } From bc7c6e97b3cd71ac751cd877c5e092d3368d4710 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 10 Nov 2018 09:32:44 -0500 Subject: [PATCH 071/371] Fixed move of default conemu.xml to the vendor folder --- launcher/src/CmderLauncher.cpp | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6d81411..318ef61 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -207,7 +207,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(cfgPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.xml"); // Set path to Cmder default ConEmu config file - PathCombine(defaultCfgPath, exeDir, L"config\\vendor\\ConEmu.xml.default"); + PathCombine(defaultCfgPath, exeDir, L"vendor\\ConEmu.xml.default"); // Check for machine-specific then user config source file. PathCombine(cpuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); @@ -216,75 +216,76 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) // If machine-specific ConEmu config file exists - use it. + if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it. { - if (PathFileExists(cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml. + if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml. { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location! Restart Cmder as Administrator." - : L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } } - else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file + else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file { if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator." - : L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } } } - else if (PathFileExists(userCfgPath)) // If config/user_conemu.xml exists use it. + else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. { - if (PathFileExists(cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml. + if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml. { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy ConEmu.xml file to backup location! Restart Cmder as Administrator." - : L"Failed to copy ConEmu.xml file to backup location!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } } - else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml + else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml { if (!CopyFile(userCfgPath, cfgPath, FALSE)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator." - : L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } } } - else if (PathFileExists(cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml + else if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy ConEmu.xml file to user-conemu.xml backup location! Restart Cmder as Administrator." - : L"Failed to copy ConEmu.xml file to user-conemu.xml backup location!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } } - else // No previous conemu.xml config exists use the default. + else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml. { - if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) + if ( ! CopyFile(defaultCfgPath, cfgPath, FALSE)) { + ShowErrorAndExit(GetLastError(), __WFUNCTION__, __LINE__); MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator." - : L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } } @@ -459,7 +460,6 @@ cmderOptions GetOption() { // MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK); - if (_wcsicmp(L"/c", szArgList[i]) == 0) { TCHAR userProfile[MAX_PATH]; From d04cc1f04ea3f79d4259dab7e35b0771a0127de9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 10 Nov 2018 13:57:26 -0500 Subject: [PATCH 072/371] fix timer error --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 57c7b35..8a4d71a 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -401,6 +401,6 @@ set CMDER_CONFIGURED=1 set cmder_init_end=%time% if %time_init% gtr 0 ( - %cmder_root%\vendor\bin\timer.cmd %cmder_init_start% %cmder_init_end% + "%cmder_root%\vendor\bin\timer.cmd" %cmder_init_start% %cmder_init_end% ) exit /b From e904ebce72b6b612c37269298b8b831b2d1d4311 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 10 Nov 2018 17:25:17 -0500 Subject: [PATCH 073/371] use user_conemu.xml or conemu-%computername%.xml directly if '-c [path]' is used to start cmder. --- launcher/src/CmderLauncher.cpp | 148 ++++++++++++++++++++------------- vendor/init.bat | 2 + 2 files changed, 91 insertions(+), 59 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 318ef61..b7d3868 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -91,6 +91,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t userAliasesPath[MAX_PATH] = { 0 }; wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 }; wchar_t args[MAX_PATH * 2 + 256] = { 0 }; + wchar_t userConEmuCfgPath[MAX_PATH] = { 0 }; + std::wstring cmderStart = path; std::wstring cmderTask = taskName; @@ -218,32 +220,72 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it. { - if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml. + if (cfgRoot.length() == 0) // '-C [PATH]' was NOT specified { - if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) + if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml. { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied." - : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP); - exit(1); + if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + } + else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file + { + if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } } } - else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file + else // '-C [PATH]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu. { - if (!CopyFile(cpuCfgPath, cfgPath, FALSE)) - { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." - : L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); - exit(1); - } + PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); + ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0])); } } else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. { - if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml. + if (cfgRoot.length() == 0) // '-C [PATH]' was NOT specified + { + if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml. + { + if (!CopyFile(cfgPath, userCfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + } + else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml + { + if (!CopyFile(userCfgPath, cfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + } + } + else // '-C [PATH]' was specified, don't copy anything and use existing user_conemu.xml to start comemu. + { + PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); + } + } + else if (cfgRoot.length() == 0) // '-C [PATH]' was NOT specified + { + if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml { if (!CopyFile(cfgPath, userCfgPath, FALSE)) { @@ -253,41 +295,30 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } - } - else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml - { - if (!CopyFile(userCfgPath, cfgPath, FALSE)) + else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml. { - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." - : L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); - exit(1); + if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } } } } - else if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml + else // '-C [PATH]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'. { - if (!CopyFile(cfgPath, userCfgPath, FALSE)) + if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE)) { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied." - : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); - exit(1); - } - } - else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml. - { - if ( ! CopyFile(defaultCfgPath, cfgPath, FALSE)) - { - ShowErrorAndExit(GetLastError(), __WFUNCTION__, __LINE__); - MessageBox(NULL, - (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." - : L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); + ? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied." + : L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } + PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } SYSTEM_INFO sysInfo; @@ -301,27 +332,26 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe"); } + swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder", args, icoPath); + + if (!streqi(cmderStart.c_str(), L"")) + { + swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str()); + } + if (is_single_mode) { - if (!streqi(cmderTask.c_str(), L"")) - { - swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str()); - } - else - { - swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); - } + swprintf_s(args, L"%s /single", args); } - else + + if (!streqi(cmderTask.c_str(), L"")) { - if (!streqi(cmderTask.c_str(), L"")) - { - swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str()); - } - else - { - swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str()); - } + swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str()); + } + + if (cfgRoot.length() != 0) + { + swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); } SetEnvironmentVariable(L"CMDER_ROOT", exeDir); diff --git a/vendor/init.bat b/vendor/init.bat index 8a4d71a..a7452a1 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -346,6 +346,7 @@ if not defined HOME set "HOME=%USERPROFILE%" set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" if exist "%CMDER_ROOT%\config\user_profile.cmd" ( REM Create this file and place your own command in there + %lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd" call "%CMDER_ROOT%\config\user_profile.cmd" ) @@ -353,6 +354,7 @@ if defined CMDER_USER_CONFIG ( set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( REM Create this file and place your own command in there + %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd call "%CMDER_USER_CONFIG%\user_profile.cmd" ) ) From e17b04cbb941561cececd36aca9914c251d0cb3c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 10 Nov 2018 18:49:33 -0500 Subject: [PATCH 074/371] cleanup --- launcher/src/CmderLauncher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index b7d3868..37f8a81 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -295,7 +295,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } - else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml. + else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml. { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { From 8c0817941e6c4bac6e17de191f3d10b0a76e8182 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 11 Nov 2018 07:55:14 -0500 Subject: [PATCH 075/371] added /c [path] use vendored conemu.xml as a default starting point if it exists --- launcher/src/CmderLauncher.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 37f8a81..b4f43be 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -295,7 +295,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } - else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml. + else // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml. { if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) { @@ -308,6 +308,19 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } + else if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml + { + if (!CopyFile(cfgPath, userCfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + + PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); + } else // '-C [PATH]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'. { if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE)) From 0efeaa91fad426a12031b3c1bc0249d004c5629e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 11 Nov 2018 08:04:35 -0500 Subject: [PATCH 076/371] cleanup --- launcher/src/CmderLauncher.cpp | 14 +++++++------- vendor/init.bat | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index b4f43be..453a750 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -149,7 +149,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } /* - Was -c [path] specified? + Was /c [path] specified? */ if (wcscmp(userConfigDirPath, L"") == 0) { @@ -220,7 +220,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it. { - if (cfgRoot.length() == 0) // '-C [PATH]' was NOT specified + if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml. { @@ -245,7 +245,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else // '-C [PATH]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu. + else // '/c [path]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu. { PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0])); @@ -253,7 +253,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it. { - if (cfgRoot.length() == 0) // '-C [PATH]' was NOT specified + if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml. { @@ -278,12 +278,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } - else // '-C [PATH]' was specified, don't copy anything and use existing user_conemu.xml to start comemu. + else // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu. { PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } } - else if (cfgRoot.length() == 0) // '-C [PATH]' was NOT specified + else if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml { @@ -321,7 +321,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml"); } - else // '-C [PATH]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'. + else // '/c [path]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'. { if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE)) { diff --git a/vendor/init.bat b/vendor/init.bat index a7452a1..30384ed 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -1,6 +1,6 @@ @echo off -set cmder_init_start=%time% +set CMDER_INIT_START=%time% :: Init Script for cmd.exe :: Created as part of cmder project @@ -400,9 +400,9 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD set initialConfig= set CMDER_CONFIGURED=1 -set cmder_init_end=%time% +set CMDER_INIT_END=%time% if %time_init% gtr 0 ( - "%cmder_root%\vendor\bin\timer.cmd" %cmder_init_start% %cmder_init_end% + "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% ) exit /b From d8e8fc8adb03129658d4dad6eb012d30c2f5729e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 12 Nov 2018 07:56:55 -0500 Subject: [PATCH 077/371] add /m command line argument to use machine config rather than user config for conemu. --- .gitignore | 2 ++ launcher/src/CmderLauncher.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ac64e10..4a75750 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ vendor/*/* config/* !config/Readme.md +config_user/* + Thumbs.db *.exe *.dll diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 453a750..33e2f41 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -69,7 +69,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"") +void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true) { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -218,7 +218,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr // Set path to Cmder user ConEmu config file PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it. + if ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config. { if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { @@ -486,6 +486,7 @@ struct cmderOptions std::wstring cmderTask = L""; std::wstring cmderRegScope = L"USER"; bool cmderSingle = false; + bool cmderUserCfg = true; bool registerApp = false; bool unRegisterApp = false; bool error = false; @@ -546,6 +547,10 @@ cmderOptions GetOption() { cmderOptions.cmderSingle = true; } + else if (_wcsicmp(L"/m", szArgList[i]) == 0) + { + cmderOptions.cmderUserCfg = false; + } else if (_wcsicmp(L"/register", szArgList[i]) == 0) { cmderOptions.registerApp = true; @@ -592,7 +597,7 @@ cmderOptions GetOption() } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } @@ -629,7 +634,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot); + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg); } return 0; From b16aa7a29e777c6d3a9240ffbb3ce96708ac14ca Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 12 Nov 2018 08:30:44 -0500 Subject: [PATCH 078/371] better command line error handling --- launcher/src/CmderLauncher.cpp | 169 ++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 77 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 33e2f41..2a2c937 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -247,6 +247,18 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } else // '/c [path]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu. { + if (use_user_cfg == false && PathFileExists(cfgPath) && !PathFileExists(cpuCfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml. + { + if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied." + : L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + } + PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml"); ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0])); } @@ -504,102 +516,105 @@ cmderOptions GetOption() { // MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK); - if (_wcsicmp(L"/c", szArgList[i]) == 0) - { - TCHAR userProfile[MAX_PATH]; - const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", userProfile, MAX_PATH); + if (cmderOptions.error == false) { + if (_wcsicmp(L"/c", szArgList[i]) == 0) + { + TCHAR userProfile[MAX_PATH]; + const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", userProfile, MAX_PATH); - wchar_t cmderCfgRoot[MAX_PATH] = { 0 }; - PathCombine(cmderCfgRoot, userProfile, L"cmder_cfg"); + wchar_t cmderCfgRoot[MAX_PATH] = { 0 }; + PathCombine(cmderCfgRoot, userProfile, L"cmder_cfg"); - cmderOptions.cmderCfgRoot = cmderCfgRoot; + cmderOptions.cmderCfgRoot = cmderCfgRoot; - if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') - { - cmderOptions.cmderCfgRoot = szArgList[i + 1]; - i++; - } - } - else if (_wcsicmp(L"/start", szArgList[i]) == 0) - { - int len = wcslen(szArgList[i + 1]); - if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0) - { - szArgList[i + 1][len - 1] = '\0'; - } - - if (PathFileExists(szArgList[i + 1])) - { - cmderOptions.cmderStart = szArgList[i + 1]; - i++; - } - else - { - MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); - } - } - else if (_wcsicmp(L"/task", szArgList[i]) == 0) - { - cmderOptions.cmderTask = szArgList[i + 1]; - i++; - } - else if (_wcsicmp(L"/single", szArgList[i]) == 0) - { - cmderOptions.cmderSingle = true; - } - else if (_wcsicmp(L"/m", szArgList[i]) == 0) - { - cmderOptions.cmderUserCfg = false; - } - else if (_wcsicmp(L"/register", szArgList[i]) == 0) - { - cmderOptions.registerApp = true; - cmderOptions.unRegisterApp = false; - if (szArgList[i + 1] != NULL) - { - if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0) + if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/') { - cmderOptions.cmderRegScope = szArgList[i + 1]; + cmderOptions.cmderCfgRoot = szArgList[i + 1]; i++; } } - } - else if (_wcsicmp(L"/unregister", szArgList[i]) == 0) - { - cmderOptions.unRegisterApp = true; - cmderOptions.registerApp = false; - if (szArgList[i + 1] != NULL) + else if (_wcsicmp(L"/start", szArgList[i]) == 0) { - if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0) + int len = wcslen(szArgList[i + 1]); + if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0) { - cmderOptions.cmderRegScope = szArgList[i + 1]; + szArgList[i + 1][len - 1] = '\0'; + } + + if (PathFileExists(szArgList[i + 1])) + { + cmderOptions.cmderStart = szArgList[i + 1]; i++; } + else + { + MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); + } } - } - else if (cmderOptions.cmderStart == L"") - { - int len = wcslen(szArgList[i]); - if (wcscmp(&szArgList[i][len - 1], L"\"") == 0) + else if (_wcsicmp(L"/task", szArgList[i]) == 0) { - szArgList[i][len - 1] = '\0'; - } - - if (PathFileExists(szArgList[i])) - { - cmderOptions.cmderStart = szArgList[i]; + cmderOptions.cmderTask = szArgList[i + 1]; i++; } + else if (_wcsicmp(L"/single", szArgList[i]) == 0) + { + cmderOptions.cmderSingle = true; + } + else if (_wcsicmp(L"/m", szArgList[i]) == 0) + { + cmderOptions.cmderUserCfg = false; + } + else if (_wcsicmp(L"/register", szArgList[i]) == 0) + { + cmderOptions.registerApp = true; + cmderOptions.unRegisterApp = false; + if (szArgList[i + 1] != NULL) + { + if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0) + { + cmderOptions.cmderRegScope = szArgList[i + 1]; + i++; + } + } + } + else if (_wcsicmp(L"/unregister", szArgList[i]) == 0) + { + cmderOptions.unRegisterApp = true; + cmderOptions.registerApp = false; + if (szArgList[i + 1] != NULL) + { + if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0) + { + cmderOptions.cmderRegScope = szArgList[i + 1]; + i++; + } + } + } + else if (cmderOptions.cmderStart == L"") + { + int len = wcslen(szArgList[i]); + if (wcscmp(&szArgList[i][len - 1], L"\"") == 0) + { + szArgList[i][len - 1] = '\0'; + } + + if (PathFileExists(szArgList[i])) + { + cmderOptions.cmderStart = szArgList[i]; + i++; + } + else + { + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + cmderOptions.error = true; + } + } else { - MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + cmderOptions.error = true; } } - else - { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); - cmderOptions.error = true; - } } LocalFree(szArgList); From 787ac3773cab86d31f477abd1a31808a7c39dfe5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 12 Nov 2018 09:22:05 -0500 Subject: [PATCH 079/371] make /register work with /c --- README.md | 15 +++++++++------ launcher/src/CmderLauncher.cpp | 19 +++++++++++++++---- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b56c05b..46d8dfd 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,15 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can ## Cmder.exe Command Line Arguments -| Argument | Description | -| ------------------- | ----------------------------------------------------------------------- | -| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` | -| `/SINGLE` | Start Cmder in single mode. | -| `/START [start_path]` | Folder path to start in. | -| `/TASK [task_name]` | Task to start after launch. | +| Argument | Description | +| ------------------- | ----------------------------------------------------------------------- | +| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` | +| `/M` | Use `conemu-%computername%.xml` for ConEmu settings storage instead of `user_conemu.xml` | +| `/REGISTER [ALL, USER]` | Register a Windows Shell Menu shortcut. | +| `/UNREGISTER [ALL, USER]` | Un-register a Windows Shell Menu shortcut. | +| `/SINGLE` | Start Cmder in single mode. | +| `/START [start_path]` | Folder path to start in. | +| `/TASK [task_name]` | Task to start after launch. | ## Context Menu Integration diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 2a2c937..438a6d2 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -442,8 +442,10 @@ HKEY GetRootKey(std::wstring opt) return root; } -void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName) +void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgRoot = L"") { + wchar_t userConfigDirPath[MAX_PATH] = { 0 }; + // First, get the paths we will use wchar_t exePath[MAX_PATH] = { 0 }; @@ -452,7 +454,16 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName) GetModuleFileName(NULL, exePath, sizeof(exePath)); wchar_t commandStr[MAX_PATH + 20] = { 0 }; - swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath); + + if (cfgRoot.length() == 0) // '/c [path]' was NOT specified + { + swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath); + } + else { + std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); + userConfigDirPath[cfgRoot.length()] = 0; + swprintf_s(commandStr, L"\"%s\" /c \"%s\" \"%%V\"", exePath, userConfigDirPath); + } // Now that we have `commandStr`, it's OK to change `exePath`... PathRemoveFileSpec(exePath); @@ -635,8 +646,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, if (cmderOptions.registerApp == true) { - RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); - RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot); } else if (cmderOptions.unRegisterApp == true) { From 7203671fc9fe2922c4de6e3c484b1c347855b2eb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 17 Nov 2018 19:55:24 -0500 Subject: [PATCH 080/371] fix powershell profile.d --- vendor/profile.ps1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 995b745..159ebe2 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -128,20 +128,30 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { } pushd $ENV:CMDER_ROOT\config\profile.d -foreach ($x in Get-ChildItem *.ps1) { +foreach ($x in Get-ChildItem *.psm1) { # write-host write-host Sourcing $x Import-Module $x } + +foreach ($x in Get-ChildItem *.ps1) { + # write-host write-host Sourcing $x + . $x +} popd # Drop *.ps1 files into "$ENV:CMDER_USER_CONFIG\config\profile.d" # to source them at startup. Requires using cmder.exe /C [cmder_user_root_path] argument if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profile.d")) { pushd $ENV:CMDER_USER_CONFIG\profile.d - foreach ($x in Get-ChildItem *.ps1) { + foreach ($x in Get-ChildItem *.psm1) { # write-host write-host Sourcing $x Import-Module $x } + + foreach ($x in Get-ChildItem *.ps1) { + # write-host write-host Sourcing $x + . $x + } popd } @@ -153,7 +163,7 @@ if (test-path "$env:CMDER_ROOT\config\user-profile.ps1") { $CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user_profile.ps1" if (Test-Path $CmderUserProfilePath) { # Create this file and place your own command in there. - Import-Module "$CmderUserProfilePath" + . "$CmderUserProfilePath" # user_profile.ps1 is not a module DO NOT USE import-module } if ($ENV:CMDER_USER_CONFIG) { @@ -166,7 +176,7 @@ if ($ENV:CMDER_USER_CONFIG) { $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1" if (Test-Path $CmderUserProfilePath) { - Import-Module "$CmderUserProfilePath" + . "$CmderUserProfilePath" # user_profile.ps1 is not a module DO NOT USE import-module } } From 036cf09360b232bd2d996427aee170eb3bd52b93 Mon Sep 17 00:00:00 2001 From: Daniel Chesters Date: Thu, 22 Nov 2018 21:14:02 +0100 Subject: [PATCH 081/371] Ensure use the system find and findstr command instead find/findstr from path. Fix #1959 --- vendor/bin/alias.cmd | 8 ++++---- vendor/bin/cexec.cmd | 2 +- vendor/init.bat | 2 +- vendor/lib/lib_base.cmd | 8 ++++---- vendor/lib/lib_path.cmd | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 50e22e7..1a1739d 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -40,7 +40,7 @@ goto parseargument ) else if "%currentarg%" neq "" ( if "%~2" equ "" ( :: Show the specified alias - doskey /macros | findstr /b %currentarg%= && exit /b + doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b echo insufficient parameters. goto :p_help ) else ( @@ -85,7 +85,7 @@ if not ["%_temp%"] == ["%alias_name%"] ( ) :: replace already defined alias -findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" +%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey /macrofile="%ALIASES%" endlocal @@ -93,7 +93,7 @@ exit /b :p_del set del_alias=%~1 -findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" +%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey %del_alias%= doskey /macrofile="%ALIASES%" @@ -105,7 +105,7 @@ echo Aliases reloaded exit /b :p_show -doskey /macros|findstr /v /r "^;=" | sort +doskey /macros|%WINDIR%\System32\findstr /v /r "^;=" | sort exit /b :p_help diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index 3193f4f..02ecba5 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -52,7 +52,7 @@ set "feFlagName=%feFlagName% " :: echo %feCommand% :: echo %feParam% :: echo. -echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul +echo %CMDER_USER_FLAGS% | %WINDIR%\System32\find /i "%feFlagName%">nul if "%ERRORLEVEL%" == "0" ( if "%feNOT%" == "false" ( endlocal && call %feCommand% %feParam% diff --git a/vendor/init.bat b/vendor/init.bat index 8a4d71a..519b580 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -300,7 +300,7 @@ if "%CMDER_ALIASES%" == "1" ( echo Creating initial user_aliases store in "%user_aliases%"... copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" ) else ( - type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul + type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul if "!errorlevel!" == "1" ( echo Creating initial user_aliases store in "%user_aliases%"... if defined CMDER_USER_CONFIG ( diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 8577637..705cca2 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -27,7 +27,7 @@ exit /b ::: file full path to file containing lib_routines to display :::. :::------------------------------------------------------------------------------- - for /f "tokens=* delims=:" %%a in ('type "%~1" ^| findstr /i /r "^:::"') do ( + for /f "tokens=* delims=:" %%a in ('type "%~1" ^| %WINDIR%\System32\findstr /i /r "^:::"') do ( rem echo a="%%a" if "%%a"=="." ( @@ -61,9 +61,9 @@ exit /b ::: file full path to file containing lib_routines to display :::. :::------------------------------------------------------------------------------- - echo %comspec% | find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd" - echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" - echo %comspec% | find /i "\tccle" > nul && set "CMDER_SHELL=tccle" + echo %comspec% | %WINDIR%\System32\find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd" + echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" + echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle" set CMDER_CLINK=1 if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index b1a6d2d..6e31560 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -68,14 +68,14 @@ exit /b if "%CMDER_CONFIGURED%" == "1" ( %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" - echo "%path%"|findstr >nul /I /R ";%find_query%\"$" + echo "%path%"|%WINDIR%\System32\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" ( if "%CMDER_CONFIGURED%" == "1" ( - echo "%path%"|findstr >nul /i /r ";%find_query%;" + echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;" if "!ERRORLEVEL!" == "0" set found=1 ) %lib_console% debug_output :enhance_path "Env Var 2 - found=!found!" From 572a94ca3a32061d48216cc28375ab457b2794cc Mon Sep 17 00:00:00 2001 From: "Van der Boon, Robert GSNL-PTT/SPD" Date: Fri, 30 Nov 2018 12:01:21 +0100 Subject: [PATCH 082/371] Improve LANG env var detection --- vendor/init.bat | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 1a5c1bb..af79340 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -243,9 +243,16 @@ if defined GIT_INSTALL_ROOT ( :: 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" - - for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do ( - set "LANG=%%F" + + if not defined LANG ( + :: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. + if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe" + if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F") + if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale + if not defined git_locale set git_locale=env /usr/bin/locale + for /F "delims=" %%F in ('!git_locale! -uU 2') do ( + set "LANG=%%F" + ) ) ) From 5c7f4943ad9a1cd1f2183fc003914ba8b9148251 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 30 Nov 2018 14:56:30 -0500 Subject: [PATCH 083/371] fix initial launch of cmder starting with conemu default cfg --- launcher/src/CmderLauncher.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 438a6d2..6c281e5 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -319,6 +319,16 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr } } } + else { + if (!CopyFile(defaultCfgPath, cfgPath, FALSE)) + { + MessageBox(NULL, + (GetLastError() == ERROR_ACCESS_DENIED) + ? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + : L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); + exit(1); + } + } } else if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml { From 1eb03dd1b81d5b1c61686312bf3256d15c6b29b0 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Dec 2018 11:44:18 -0500 Subject: [PATCH 084/371] add '/prefer_nix' switch to init.bat --- vendor/init.bat | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 1a5c1bb..60fcd7c 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -14,6 +14,7 @@ set debug_output=0 set time_init=0 set fast_init=0 set max_depth=1 +set prefer_windows_commands=1 set "CMDER_USER_FLAGS= " :: Find root dir @@ -90,6 +91,9 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1" == "/svn_ssh" ( set SVN_SSH=%2 shift + ) else if /i "%1" == "/prefer_nix" ( + set prefer_windows_commands=0 + shift ) else ( set "CMDER_USER_FLAGS=%1 %CMDER_USER_FLAGS%" ) @@ -233,18 +237,25 @@ goto :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 - if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" append - if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" append - ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" append + if "%prefer_windows_commands%" == "1" ( + echo PREFERRING WINDOWS COMMANDS + set "path_position=append" + ) else ( + echo PREFERRING UNIX COMMANDS + set "path_position=" ) - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append + if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" !path_position! + if exist "!GIT_INSTALL_ROOT!\mingw32" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! + ) 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!\usr\bin" !path_position! :: 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" - for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do ( + for /F "delims=" %%F in ('%GIT_INSTALL_ROOT%\usr\bin\env /usr/bin/locale -uU 2') do ( set "LANG=%%F" ) ) From fcab51da2b25f3ba730ddbb95a00f00128e72f80 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Dec 2018 11:46:23 -0500 Subject: [PATCH 085/371] remove file --- vendor/init.bat.orig | 432 ------------------------------------------- 1 file changed, 432 deletions(-) delete mode 100644 vendor/init.bat.orig diff --git a/vendor/init.bat.orig b/vendor/init.bat.orig deleted file mode 100644 index e4b7e36..0000000 --- a/vendor/init.bat.orig +++ /dev/null @@ -1,432 +0,0 @@ -@echo off - -set CMDER_INIT_START=%time% - -:: Init Script for cmd.exe -:: Created as part of cmder project - -:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED -:: !!! 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. -set verbose_output=0 -set debug_output=0 -set time_init=0 -set fast_init=0 -set max_depth=1 -set prefer_windows_commands=1 -set "CMDER_USER_FLAGS= " - -:: Find root dir -if not defined CMDER_ROOT ( - if defined ConEmuDir ( - for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( - set "CMDER_ROOT=%%~fi" - ) - ) else ( - for /f "delims=" %%i in ("%~dp0\..") do ( - set "CMDER_ROOT=%%~fi" - ) - ) -) - -:: Remove trailing '\' from %CMDER_ROOT% -if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%" - -call "%cmder_root%\vendor\bin\cexec.cmd" /setpath -call "%cmder_root%\vendor\lib\lib_base" -call "%cmder_root%\vendor\lib\lib_path" -call "%cmder_root%\vendor\lib\lib_console" -call "%cmder_root%\vendor\lib\lib_git" -call "%cmder_root%\vendor\lib\lib_profile" - -:var_loop - if "%~1" == "" ( - goto :start - ) 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 - ) else if /i "%1"=="/d" ( - set debug_output=1 - ) else if /i "%1" == "/max_depth" ( - if "%~2" geq "1" if "%~2" leq "5" ( - set "max_depth=%~2" - shift - ) else ( - %lib_console% show_error "'/max_depth' requires a number between 1 and 5!" - exit /b - ) - ) else if /i "%1" == "/c" ( - if exist "%~2" ( - if not exist "%~2\bin" mkdir "%~2\bin" - set "cmder_user_bin=%~2\bin" - if not exist "%~2\config\profile.d" mkdir "%~2\config\profile.d" - set "cmder_user_config=%~2\config" - shift - ) - ) else if /i "%1" == "/user_aliases" ( - if exist "%~2" ( - set "user_aliases=%~2" - shift - ) - ) else if /i "%1" == "/git_install_root" ( - if exist "%~2" ( - set "GIT_INSTALL_ROOT=%~2" - shift - ) else ( - %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" - exit /b - ) - ) else if /i "%1" == "/home" ( - if exist "%~2" ( - set "HOME=%~2" - shift - ) else ( - %lib_console% show_error The home folder "%2", you specified does not exist! - exit /b - ) - ) else if /i "%1" == "/svn_ssh" ( - set SVN_SSH=%2 - shift - ) else if /i "%1" == "/prefer_nix" ( - set prefer_windows_commands=0 - shift - ) else ( - set "CMDER_USER_FLAGS=%1 %CMDER_USER_FLAGS%" - ) - shift -goto var_loop - -:start -:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES -%lib_base% cmder_shell -%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" -%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" - -if defined CMDER_USER_CONFIG ( - %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" -) - -:: Pick right version of clink -if "%PROCESSOR_ARCHITECTURE%"=="x86" ( - set architecture=86 - set architecture_bits=32 -) else ( - set architecture=64 - set architecture_bits=64 -) - -if "%CMDER_CLINK%" == "1" ( - %lib_console% verbose_output "Injecting Clink!" - - :: Run clink - if defined CMDER_USER_CONFIG ( - if not exist "%CMDER_USER_CONFIG%\settings" ( - echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" - echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ - ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" - ) else ( - if not exist "%CMDER_ROOT%\config\settings" ( - echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" - echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. - ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" - ) -) else ( - %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" -) - -:: Prepare for git-for-windows - -:: I do not even know, copypasted from their .bat -set PLINK_PROTOCOL=ssh -if not defined TERM set TERM=cygwin - -:: The idea: -:: * if the users points as to a specific git, use that -:: * test if a git is in path and if yes, use that -:: * last, use our vendored git -:: 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 :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..." - -:: 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% - -:: check if git is in path... -for /F "delims=" %%F in ('where git.exe 2^>nul') do ( - :: get the absolute path to the user provided git binary - pushd %%~dpF - :: check if there's shim - and if yes follow the path - if exist git.shim ( - for /F "tokens=2 delims== " %%I in (git.shim) do ( - pushd %%~dpI - set "test_dir=!CD!" - popd - ) - ) else ( - set "test_dir=!CD!" - ) - popd - - :: get the version information for the user provided git binary - %lib_git% read_version USER "!test_dir!" - %lib_git% validate_version USER !GIT_VERSION_USER! - - if !errorlevel! geq 0 ( - :: compare the user git version against the vendored version - %lib_git% compare_versions USER VENDORED - - :: use the user provided git if its version is greater than, or equal to the vendored git - if !errorlevel! geq 0 if exist "!test_dir:~0,-4!\cmd\git.exe" ( - set "GIT_INSTALL_ROOT=!test_dir:~0,-4!" - set test_dir= - goto :FOUND_GIT - ) else if !errorlevel! geq 0 ( - set "GIT_INSTALL_ROOT=!test_dir!" - set test_dir= - goto :FOUND_GIT - ) else ( - call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... - set test_dir= - ) - ) else ( - - :: if the user provided git executable is not found - if !errorlevel! equ -255 ( - call :verbose_output No git at "!git_executable!" found. - set test_dir= - ) - - ) -) - -:: our last hope: our own git... -: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!..." - 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 - if "%prefer_windows_commands%" == "1" ( - echo PREFERRING WINDOWS COMMANDS - set "path_position=append" - ) else ( - echo PREFERRING UNIX COMMANDS - set "path_position=" - ) - - if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" !path_position! - if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! - ) 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!\usr\bin" !path_position! - :: 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" -<<<<<<< HEAD - - for /F "delims=" %%F in ('%GIT_INSTALL_ROOT%\usr\bin\env /usr/bin/locale -uU 2') do ( - set "LANG=%%F" -======= - - if not defined LANG ( - :: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. - if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe" - if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F") - if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale - if not defined git_locale set git_locale=env /usr/bin/locale - for /F "delims=" %%F in ('!git_locale! -uU 2') do ( - set "LANG=%%F" - ) ->>>>>>> 3163d6d1c3b8b027390f35fa618cfab37d73a865 - ) -) - -endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" -goto :PATH_ENHANCE - -:NO_GIT -:: Skip this if GIT WAS FOUND else we did 'endlocal' above! -endlocal - -:PATH_ENHANCE -%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" -%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% -if defined CMDER_USER_BIN ( - %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth% -) -%lib_path% enhance_path "%CMDER_ROOT%" append - -:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" -:: to run them at startup. -%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" -if defined CMDER_USER_CONFIG ( - %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" -) - -:: Allows user to override default aliases store using profile.d -:: scripts run above by setting the 'aliases' env variable. -:: -:: Note: If overriding default aliases store file the aliases -:: must also be self executing, see '.\user_aliases.cmd.example', -:: and be in profile.d folder. -if not defined user_aliases ( - if defined CMDER_USER_CONFIG ( - set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd" - ) else ( - set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd" - ) -) - -if "%CMDER_ALIASES%" == "1" ( - REM The aliases environment variable is used by alias.bat to id - REM the default file to store new aliases in. - if not defined aliases ( - set "aliases=%user_aliases%" - ) - - REM Make sure we have a self-extracting user_aliases.cmd file - setlocal enabledelayedexpansion - if not exist "%user_aliases%" ( - echo Creating initial user_aliases store in "%user_aliases%"... - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" - ) else ( - type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul - if "!errorlevel!" == "1" ( - echo Creating initial user_aliases store in "%user_aliases%"... - if defined CMDER_USER_CONFIG ( - copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" - ) else ( - copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" - ) - ) - ) - - :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' - if exist "%CMDER_ROOT%\config\aliases" ( - echo Updating old "%CMDER_ROOT%\config\aliases" to new format... - type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" - del "%CMDER_ROOT%\config\aliases" - ) else if exist "%user_aliases%.old_format" ( - echo Updating old "%user_aliases%" to new format... - type "%user_aliases%.old_format" >> "%user_aliases%" - del "%user_aliases%.old_format" - ) - endlocal -) - -:: Add aliases to the environment -call "%user_aliases%" - -:: See vendor\git-for-windows\README.portable for why we do this -:: Basically we need to execute this post-install.bat because we are -:: manually extracting the archive rather than executing the 7z sfx -if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - %lib_console% verbose_output "Running Git for Windows one time Post Install...." - pushd "%GIT_INSTALL_ROOT%\" - "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat - popd -) - -:: Set home path -if not defined HOME set "HOME=%USERPROFILE%" -%lib_console% debug_output init.bat "Env Var - HOME=%HOME%" - -set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" -if exist "%CMDER_ROOT%\config\user_profile.cmd" ( - REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd" - call "%CMDER_ROOT%\config\user_profile.cmd" -) - -if defined CMDER_USER_CONFIG ( - set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" - if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( - REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd - call "%CMDER_USER_CONFIG%\user_profile.cmd" - ) -) - -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. -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 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. -echo :: you can add your plugins to the cmder path like so -echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" -echo. -echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so: -echo :: more useage can be seen by typing "cexec /?" -echo. -echo :: %%ccall%% "/customOption" "command/program" -echo. -echo @echo off -) >"%initialConfig%" -) - -if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( - echo Cmder's 'alias' command has been moved into "%CMDER_ROOT%\vendor\bin\alias.cmd" - echo to get rid of this message either: - echo. - echo Delete the file "%CMDER_ROOT%\bin\alias.bat" - echo. - echo or - echo. - echo If you have customized it and want to continue using it instead of the included version - echo * Rename "%CMDER_ROOT%\bin\alias.bat" to "%CMDER_ROOT%\bin\alias.cmd". - echo * Search for 'user-aliases' and replace it with 'user_aliases'. -) - -set initialConfig= -set CMDER_CONFIGURED=1 - -set CMDER_INIT_END=%time% - -if %time_init% gtr 0 ( - "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% -) -exit /b From 8ac540ebb6b58426f78d831bad284bc1f33c47c5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 Dec 2018 11:51:00 -0500 Subject: [PATCH 086/371] debug --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index bac8cf2..81ce792 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -238,10 +238,10 @@ goto :CONFIGURE_GIT if defined GIT_INSTALL_ROOT ( rem add the unix commands at the end to not shadow windows commands like more if "%prefer_windows_commands%" == "1" ( - echo PREFERRING WINDOWS COMMANDS + %lib_console% debug_output init.bat "Preferring Windows commands" set "path_position=append" ) else ( - echo PREFERRING UNIX COMMANDS + %lib_console% debug_output init.bat "Preferring *nix commands" set "path_position=" ) From f9f06a55954c1944d8c58909f02ae74ea5969449 Mon Sep 17 00:00:00 2001 From: Cody Ray Hoeft Date: Fri, 7 Dec 2018 21:05:51 -0800 Subject: [PATCH 087/371] make /register work with /single --- launcher/src/CmderLauncher.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 6c281e5..d9e17c9 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -452,7 +452,7 @@ HKEY GetRootKey(std::wstring opt) return root; } -void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgRoot = L"") +void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgRoot, bool single) { wchar_t userConfigDirPath[MAX_PATH] = { 0 }; @@ -464,15 +464,22 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgR GetModuleFileName(NULL, exePath, sizeof(exePath)); wchar_t commandStr[MAX_PATH + 20] = { 0 }; + wchar_t baseCommandStr[MAX_PATH + 20] = { 0 }; + if (!single) { + swprintf_s(baseCommandStr, L"\"%s\"", exePath); + } + else { + swprintf_s(baseCommandStr, L"\"%s\" /single", exePath); + } if (cfgRoot.length() == 0) // '/c [path]' was NOT specified { - swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath); + swprintf_s(commandStr, L"%s \"%%V\"", baseCommandStr); } else { std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); userConfigDirPath[cfgRoot.length()] = 0; - swprintf_s(commandStr, L"\"%s\" /c \"%s\" \"%%V\"", exePath, userConfigDirPath); + swprintf_s(commandStr, L"%s /c \"%s\" \"%%V\"", baseCommandStr, userConfigDirPath); } // Now that we have `commandStr`, it's OK to change `exePath`... @@ -656,8 +663,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, if (cmderOptions.registerApp == true) { - RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot); - RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); } else if (cmderOptions.unRegisterApp == true) { From 20eb7b8e815a907a30c3294b7a62e1b212a5e3e7 Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Mon, 3 Dec 2018 15:30:54 +0000 Subject: [PATCH 088/371] Add /nix_tools switch to init.bat to optionally add !GIT_INSTALL_ROOT!\usr\bin to PATH --- vendor/init.bat | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index af79340..7430bcd 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -14,6 +14,8 @@ set debug_output=0 set time_init=0 set fast_init=0 set max_depth=1 +:: Add *nix tools to end of path. 0 turns off *nix tools. +set nix_tools=1 set "CMDER_USER_FLAGS= " :: Find root dir @@ -79,6 +81,16 @@ call "%cmder_root%\vendor\lib\lib_profile" %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" 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 /i "%1" == "/home" ( if exist "%~2" ( set "HOME=%~2" @@ -239,7 +251,9 @@ if defined GIT_INSTALL_ROOT ( ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" append ) - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append + if %nix_tools% equ 1 ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append + ) :: 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" From 0c9e0e2f8c3c5864cdf547a3401c8518cd06a3dc Mon Sep 17 00:00:00 2001 From: Cody Ray Hoeft Date: Thu, 13 Dec 2018 12:13:17 -0800 Subject: [PATCH 089/371] Use default files for default user profiles --- config/Readme.md | 5 ++- vendor/cmder.sh | 7 +--- vendor/cmder_exinit | 7 +--- vendor/init.bat | 30 +++------------ vendor/profile.ps1 | 37 +------------------ ...s.cmd.example => user_aliases.cmd.default} | 0 vendor/user_profile.cmd.default | 19 ++++++++++ vendor/user_profile.ps1.default | 25 +++++++++++++ vendor/user_profile.sh.default | 32 ++++++++++++++++ 9 files changed, 88 insertions(+), 74 deletions(-) rename vendor/{user_aliases.cmd.example => user_aliases.cmd.default} (100%) create mode 100644 vendor/user_profile.cmd.default create mode 100644 vendor/user_profile.ps1.default create mode 100644 vendor/user_profile.sh.default diff --git a/config/Readme.md b/config/Readme.md index 5a72301..d123efc 100644 --- a/config/Readme.md +++ b/config/Readme.md @@ -4,11 +4,12 @@ All config files must be in this folder. If there is no option to set this folde directly, it has to be hardlinked. * `user-aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from - `vendor\user-aliases.cmd.example`. + `vendor\user-aliases.cmd.default`. * `*.lua`: clink completions and prompt filters; autoloaded after all prompt filter and clink completions are initialized; add your own. * `user-profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their - respective startup scripts in `vendor\`; autocreated on first start of such a task. + respective startup scripts in `vendor\`; autocreated from + `vendor\user-profile.{sh|cmd|ps1}.default` on first start of such a task. * `.history`: the current commandline history; autoupdated on close. * `settings`: settings for readline; overwritten on update. * `ConEmu.xml`: settings from ConEmu (=the UI of cmder -> Preferences); overwritten on update. diff --git a/vendor/cmder.sh b/vendor/cmder.sh index a0ab173..7ccddcf 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -90,12 +90,7 @@ fi if [ ! -f "${CmderUserProfilePath}" ] ; then echo Creating user startup file: "${CmderUserProfilePath}" - cat <<-eof >"${CmderUserProfilePath}" -# use this file to run your own startup commands for msys2 bash' - -# To add a new vendor to the path, do something like: -# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH} -eof + cp "${CMDER_ROOT}/vendor/user_profile.sh.default" "${CmderUserProfilePath}" fi # Source the users .bashrc file if it exists diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index bab6f20..095a1e9 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -108,11 +108,6 @@ if [ ! "$CMDER_ROOT" = "" ] ; then if [ ! -f "${CmderUserProfilePath}" ] ; then echo Creating user startup file: "${CmderUserProfilePath}" - cat <<-eof >"${CmderUserProfilePath}" -# use this file to run your own startup commands for msys2 bash' - -# To add a new vendor to the path, do something like: -# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH} -eof + cp "${CMDER_ROOT}/vendor/user_profile.sh.default" "${CmderUserProfilePath}" fi fi diff --git a/vendor/init.bat b/vendor/init.bat index af79340..2b78aa3 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -284,7 +284,7 @@ if defined CMDER_USER_CONFIG ( :: scripts run above by setting the 'aliases' env variable. :: :: Note: If overriding default aliases store file the aliases -:: must also be self executing, see '.\user_aliases.cmd.example', +:: must also be self executing, see '.\user_aliases.cmd.default', :: and be in profile.d folder. if not defined user_aliases ( if defined CMDER_USER_CONFIG ( @@ -305,17 +305,17 @@ if "%CMDER_ALIASES%" == "1" ( setlocal enabledelayedexpansion if not exist "%user_aliases%" ( echo Creating initial user_aliases store in "%user_aliases%"... - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" ) else ( type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul if "!errorlevel!" == "1" ( echo Creating initial user_aliases store in "%user_aliases%"... if defined CMDER_USER_CONFIG ( copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" ) else ( copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" ) ) ) @@ -368,27 +368,7 @@ if defined CMDER_USER_CONFIG ( 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. -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 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. -echo :: you can add your plugins to the cmder path like so -echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" -echo. -echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so: -echo :: more useage can be seen by typing "cexec /?" -echo. -echo :: %%ccall%% "/customOption" "command/program" -echo. -echo @echo off -) >"%initialConfig%" + copy "%CMDER_ROOT%\vendor\user_profile.cmd.default" "%initialConfig%" ) if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 159ebe2..73fde18 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -181,41 +181,8 @@ if ($ENV:CMDER_USER_CONFIG) { } if (! (Test-Path $CmderUserProfilePath) ) { -# This multiline string cannot be indented, for this reason I've not indented the whole block - -Write-Host -BackgroundColor Darkgreen -ForegroundColor White "First Run: Creating user startup file: $CmderUserProfilePath" - -$UserProfileTemplate = @' -# Use this file to run your own startup commands - -## Prompt Customization -<# -.SYNTAX - - λ -.EXAMPLE - N:\Documents\src\cmder [master] - λ | -#> - -[ScriptBlock]$PrePrompt = { - -} - -# Replace the cmder prompt entirely with this. -# [ScriptBlock]$CmderPrompt = {} - -[ScriptBlock]$PostPrompt = { - -} - -## - - -'@ - -New-Item -ItemType File -Path $CmderUserProfilePath -Value $UserProfileTemplate > $null - + Write-Host -BackgroundColor Darkgreen -ForegroundColor White "First Run: Creating user startup file: $CmderUserProfilePath" + Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath } # Once Created these code blocks cannot be overwritten diff --git a/vendor/user_aliases.cmd.example b/vendor/user_aliases.cmd.default similarity index 100% rename from vendor/user_aliases.cmd.example rename to vendor/user_aliases.cmd.default diff --git a/vendor/user_profile.cmd.default b/vendor/user_profile.cmd.default new file mode 100644 index 0000000..aa5f4f8 --- /dev/null +++ b/vendor/user_profile.cmd.default @@ -0,0 +1,19 @@ +:: use this file to run your own startup commands +:: use in front of the command to prevent printing the command + +:: uncomment this to have the ssh agent load when cmder starts +:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" + +:: uncomment the next two lines to use pageant as the ssh authentication agent +:: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock +:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-pageant.cmd" + +:: you can add your plugins to the cmder path like so +:: set "PATH=%CMDER_ROOT%\vendor\whatever;%PATH%" + +:: arguments in this batch are passed from init.bat, you can quickly parse them like so: +:: more useage can be seen by typing "cexec /?" + +:: %ccall% "/customOption" "command/program" + +@echo off \ No newline at end of file diff --git a/vendor/user_profile.ps1.default b/vendor/user_profile.ps1.default new file mode 100644 index 0000000..b85ebee --- /dev/null +++ b/vendor/user_profile.ps1.default @@ -0,0 +1,25 @@ +# Use this file to run your own startup commands + +## Prompt Customization +<# +.SYNTAX + + λ +.EXAMPLE + N:\Documents\src\cmder [master] + λ | +#> + +[ScriptBlock]$PrePrompt = { + +} + +# Replace the cmder prompt entirely with this. +# [ScriptBlock]$CmderPrompt = {} + +[ScriptBlock]$PostPrompt = { + +} + +## + diff --git a/vendor/user_profile.sh.default b/vendor/user_profile.sh.default new file mode 100644 index 0000000..2e423c0 --- /dev/null +++ b/vendor/user_profile.sh.default @@ -0,0 +1,32 @@ +# use this file to run your own startup commands for msys2 bash' + +# To add a new vendor to the path, do something like: +# export PATH=${CMDER_ROOT}/vendor/whatever:${PATH} + +function launch_ssh_agent { + # Copied from (https://help.github.com/articles/working-with-ssh-key-passphrases) + env=~/.ssh/agent.env + + agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } + + agent_start () { + (umask 077; ssh-agent >| "$env") + . "$env" >| /dev/null ; } + + agent_load_env + + # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running + agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) + + if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then + agent_start + ssh-add + elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then + ssh-add + fi + + unset env +} + +# Run ssh-agent automatically when you open your first bash terminal +# launch_ssh_agent \ No newline at end of file From 0f30329e3842f782223b86b113ac30e56cc72497 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 13 Dec 2018 21:55:08 -0500 Subject: [PATCH 090/371] Update init.bat --- vendor/init.bat | 3 --- 1 file changed, 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 061642f..ed4fbca 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -106,9 +106,6 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1" == "/svn_ssh" ( set SVN_SSH=%2 shift - ) else if /i "%1" == "/prefer_nix" ( - set prefer_windows_commands=0 - shift ) else ( set "CMDER_USER_FLAGS=%1 %CMDER_USER_FLAGS%" ) From 7e1bc4297aae2888df7e7ae551fa57d553b8c069 Mon Sep 17 00:00:00 2001 From: Cody Ray Hoeft Date: Thu, 13 Dec 2018 21:12:18 -0800 Subject: [PATCH 091/371] Move ssh-agent logic to lib script --- vendor/lib/start-ssh-agent.sh | 22 ++++++++++++++++++++++ vendor/user_profile.sh.default | 29 ++--------------------------- 2 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 vendor/lib/start-ssh-agent.sh diff --git a/vendor/lib/start-ssh-agent.sh b/vendor/lib/start-ssh-agent.sh new file mode 100644 index 0000000..a359ae0 --- /dev/null +++ b/vendor/lib/start-ssh-agent.sh @@ -0,0 +1,22 @@ +# Copied from https://help.github.com/articles/working-with-ssh-key-passphrases +env=~/.ssh/agent.env + +agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } + +agent_start () { + (umask 077; ssh-agent >| "$env") + . "$env" >| /dev/null ; } + +agent_load_env + +# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running +agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) + +if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then + agent_start + ssh-add +elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then + ssh-add +fi + +unset env \ No newline at end of file diff --git a/vendor/user_profile.sh.default b/vendor/user_profile.sh.default index 2e423c0..4d55ecc 100644 --- a/vendor/user_profile.sh.default +++ b/vendor/user_profile.sh.default @@ -3,30 +3,5 @@ # To add a new vendor to the path, do something like: # export PATH=${CMDER_ROOT}/vendor/whatever:${PATH} -function launch_ssh_agent { - # Copied from (https://help.github.com/articles/working-with-ssh-key-passphrases) - env=~/.ssh/agent.env - - agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } - - agent_start () { - (umask 077; ssh-agent >| "$env") - . "$env" >| /dev/null ; } - - agent_load_env - - # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running - agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) - - if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then - agent_start - ssh-add - elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then - ssh-add - fi - - unset env -} - -# Run ssh-agent automatically when you open your first bash terminal -# launch_ssh_agent \ No newline at end of file +# Uncomment this to have the ssh agent load with the first bash terminal +# . "${CMDER_ROOT}/vendor/lib/start-ssh-agent.sh" \ No newline at end of file From 51e75d4bb5a76b05e8b96674405749f00ec296a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=B6hm?= Date: Wed, 19 Dec 2018 21:17:45 +0100 Subject: [PATCH 092/371] add percent escaping for string.gsub (#1991) In `string.gsub()`, the `%` character has special meaning and must be escaped to be treated verbatim, otherwise the "invalid use of '%' in replacement string" warning will show up. This adds a verbatim() function for that purpose. It fixes this warning for situations where `'%` characters are in the current path (cwd), version control branch names, or in the previous `PROMPT` set by the user. --- vendor/clink.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 3e7c6d7..2530510 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -13,6 +13,14 @@ dofile(clink_lua_file) -- now add our own things... +--- +-- Makes a string safe to use as the replacement in string.gsub +--- +local function verbatim(s) + s = string.gsub(s, "%%", "%%%%") + return s +end + --- -- Setting the prompt in clink means that commands which rewrite the prompt do -- not destroy our own prompt. It also means that started cmds (or batch files @@ -41,13 +49,12 @@ local function set_prompt_filter() -- color codes: "\x1b[1;37;40m" local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m" local lambda = "λ" - cwd = string.gsub(cwd, "%%", "{percent}") - cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd) + cmder_prompt = string.gsub(cmder_prompt, "{cwd}", verbatim(cwd)) if env ~= nil then lambda = "("..env..") "..lambda end - clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", lambda) + clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", verbatim(lambda)) end local function percent_prompt_filter() @@ -295,7 +302,7 @@ local function git_prompt_filter() color = colors.conflict end - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..branch..")") + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") return false end end @@ -340,7 +347,7 @@ local function hg_prompt_filter() end end - clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", result) + clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", verbatim(result)) return false end @@ -362,7 +369,7 @@ local function svn_prompt_filter() color = colors.dirty end - clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..branch..")") + clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..verbatim(branch)..")") return false end end From 4e4f05037442d676428d5417c933c16817d68eaf Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 22 Dec 2018 15:40:09 -0500 Subject: [PATCH 093/371] fix sshagent call in user_profile.cmd.default --- vendor/user_profile.cmd.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/user_profile.cmd.default b/vendor/user_profile.cmd.default index aa5f4f8..e5966e0 100644 --- a/vendor/user_profile.cmd.default +++ b/vendor/user_profile.cmd.default @@ -2,7 +2,7 @@ :: use in front of the command to prevent printing the command :: uncomment this to have the ssh agent load when cmder starts -:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" +:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" /k exit :: uncomment the next two lines to use pageant as the ssh authentication agent :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock @@ -16,4 +16,4 @@ :: %ccall% "/customOption" "command/program" -@echo off \ No newline at end of file +@echo off From e56ed810a0146dfca76dd5ca93c3cf185b5782a3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 22 Dec 2018 16:34:23 -0500 Subject: [PATCH 094/371] Changelog --- CHANGELOG.md | 172 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 166 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf7120..e63fd54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,175 @@ # Change Log -## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30) -**Updated components:** -* Git updated to v2.17.1.windows.2 -* ConEmu updated to 180528 +## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) -**Updates:** +### Fixes + +* Fix uncommenting `call ssh-agent` in `user_profile.cmd` breaks Cmder prompt. [#1990](https://github.com/cmderdev/cmder/issues/1990), [#1807](https://github.com/cmderdev/cmder/issues/1807), [#1785](https://github.com/cmderdev/cmder/issues/1785), [#1885](https://github.com/cmderdev/cmder/issues/1885) + * Pull Request: [#1995](https://github.com/cmderdev/cmder/issues/1995) fix sshagent call in user_profile.cmd.default +* Unable to use '%' character in git branch names [#1779](https://github.com/cmderdev/cmder/issues/1779) + * Pull Request: [#1991](https://github.com/cmderdev/cmder/issues/1991) add percent escaping for string.gsub +* sort command, unix vs windows (/usr/bin/sort vs sort.exe) [#1931](https://github.com/cmderdev/cmder/issues/1931) + * Pull Request: [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option + +### Adds + +* [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option +* [#1982](https://github.com/cmderdev/cmder/issues/1982) make /register work with /single +* [#1975](https://github.com/cmderdev/cmder/issues/1975) Add `/nix_tools 0` option to init.bat to prevent adding !GIT_INSTALL_ROOT!\usr\bin to PATH + + +### Changes + +* [#1987](https://github.com/cmderdev/cmder/issues/1987) Use default files for default user profiles + +## [1.3.10](https://github.com/cmderdev/cmder/tree/v1.3.10) (2018-11-30) + +### Fixes + +* Replaces Cmder Release v1.3.9 which has been removed. +* /c now completely separates user config including Conemu configuration. This enables true multi-user Cmder with no configuration collisions. See PR #1949. +* Fix #1959 Start cmder "find" errors. See PR #1961. +* Fix #1956 Git detection should use env from git install root. See PR #1969 + +### Adds + +* /m initially creates %cmder_root%/config/conemu-%computername%.xml for users that want per computer Conemu configuration with shared init scripts. See PR #1949. +* /register now recognizes /c [path] and creates an appropriate Cmder Here shell context menu. See PR #1949. + +## [1.3.8](https://github.com/cmderdev/cmder/tree/v1.3.8) (2018-11-10) + +### Fixes + +* Fix \vendor\bin\timer.cmd was unexpected at this time. on session start. + +## [1.3.7](https://github.com/cmderdev/cmder/tree/v1.3.7) (2018-11-10) +## Updated components + +* ConEmu to 180626 +* Update Git to 2.19.0 + +## Fixes: * Cmder now opens in the in the current working dir -* TBD + +## Commits +### Aaron Arney (1): + +* Update README + +### Arion Roberto Krause (1): + +* Fixed typo + +### Benjamin Staneck (8): + +* Revert "replace user-aliases with user_aliases" +* replace user-aliases with user_aliases +* better fix for #1265 +* Revert "sanitize dir before assigning to prompt" +* sanitize dir before assigning to prompt +* Update CHANGELOG.md + +### Bob Hood (1): + +* Refactored the Mercurial prompt code to be more efficient. + +### David Refoua (1): + +* fix some spelling issues + +### Dax T Games (30): + +* Revert "Ignore %cmder_root%\config (#1945)" +* Ignore %cmder_root%\config (#1945) +* Add /f for fast init. (#1942) +* add diag helper scripts and adds to the path (#1918) +* Fix #1806 #1675 (#1870) +* Profile.ps1 (#1796) +* Fix lib base (#1794) +* Little Changes +* Fixed move of default conemu.xml to the vendor folder +* ignore all of config folder +* move default comemu.xml to vendor folder +* fixes +* more headers +* init.bat update for cexec +* git prompt yellow +* fix user lua and git detection +* allow conditionally setting environment variables +* added exit codes +* flag_exists.cmd to flag_exec.cmd, also to lib as an option +* fixed +* handle start dir args with trailing " +* cleanup +* '.gitignore' +* verbose output +* cmder_shell settings +* add cmder_shell method +* replace - with \_ in debug-output and verbose-output +* Trying to get tcc working +* move user-aliases.cmd to user_aliases.cmd +* move bin\alias.bat to vendor\bin\alias.cmd +* fix /unregister + +### Dmitri S. Guskov (2): + +* Powershell 5.1 compatibility +* Update profile.ps1 + +### Gregory Lucas (1): + +* Initialize time_init to fix init error message + +### Josef Pihrt (2): + +* Fix typos, remove escaping inside inline code, replace single quote with backtick +* Fix typo and broken link + +### Merlin (1): + +* Remove duplicate Install-Module detection + +### Nicolas Arnaud-Cormos (1): + +* Ensure the right git path is found in case of shim. + +### Thorsten Sommer (1): + +* Fixed spelling + +### gaoslin (1): + +* Update init.bat + +### leochien0102 (1): + +* fix the 'was unexpected at this time.' + +### xiazeyu (4): + +* chore: unite slash +* docs: update to latest useage +* refactor: reduce global varible useage, fixed quote issue, added parameters support +* doc: fix typo + +### xiazeyu_2011 (8): + +* docs: migrated instructions to the wiki pages +* rename /bin/have.bat to /vendor/lib/flag_exists.cmd +* fix: bug when no argument is passed in +* docs: update doc for have.bat +* feat: add have.bat as a wrapper +* Optimize comments of using arguments in user-profile.cmd +* fix conflict with init.bat build-in command parser, update user-profile.cmd +* Pass arguments to user-profile.cmd + +刘祺 (1): + +* add LANG support + +## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30) ## [1.3.6-pre2](https://github.com/cmderdev/cmder/tree/v1.3.6-pre2) (2018-03-01) From ccb6cb80e5fc2b85a7f1430f563c08c3d3e3f20e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 22 Dec 2018 16:37:28 -0500 Subject: [PATCH 095/371] Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e63fd54..0e260cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -171,6 +171,11 @@ ## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30) +**Updated components:** + +* Git updated to v2.17.1.windows.2 +* ConEmu updated to 180528 + ## [1.3.6-pre2](https://github.com/cmderdev/cmder/tree/v1.3.6-pre2) (2018-03-01) **Updated components:** From e822d55aa52da5fbe87eaec1032666b7ad496f0a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 22 Dec 2018 16:38:51 -0500 Subject: [PATCH 096/371] Changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e260cb..7a3c8a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -176,6 +176,10 @@ * Git updated to v2.17.1.windows.2 * ConEmu updated to 180528 +**Updates:** + + * Cmder now opens in the in the current working dir + ## [1.3.6-pre2](https://github.com/cmderdev/cmder/tree/v1.3.6-pre2) (2018-03-01) **Updated components:** From 88169b8721fe7fbc45e70445b913f25f4c4c7930 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 22 Dec 2018 16:55:17 -0500 Subject: [PATCH 097/371] Revert "Update Changelog" --- CHANGELOG.md | 177 ++------------------------------------------------- 1 file changed, 4 insertions(+), 173 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a3c8a2..aaf7120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,184 +1,15 @@ # Change Log - -## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) - -### Fixes - -* Fix uncommenting `call ssh-agent` in `user_profile.cmd` breaks Cmder prompt. [#1990](https://github.com/cmderdev/cmder/issues/1990), [#1807](https://github.com/cmderdev/cmder/issues/1807), [#1785](https://github.com/cmderdev/cmder/issues/1785), [#1885](https://github.com/cmderdev/cmder/issues/1885) - * Pull Request: [#1995](https://github.com/cmderdev/cmder/issues/1995) fix sshagent call in user_profile.cmd.default -* Unable to use '%' character in git branch names [#1779](https://github.com/cmderdev/cmder/issues/1779) - * Pull Request: [#1991](https://github.com/cmderdev/cmder/issues/1991) add percent escaping for string.gsub -* sort command, unix vs windows (/usr/bin/sort vs sort.exe) [#1931](https://github.com/cmderdev/cmder/issues/1931) - * Pull Request: [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option - -### Adds - -* [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option -* [#1982](https://github.com/cmderdev/cmder/issues/1982) make /register work with /single -* [#1975](https://github.com/cmderdev/cmder/issues/1975) Add `/nix_tools 0` option to init.bat to prevent adding !GIT_INSTALL_ROOT!\usr\bin to PATH - - -### Changes - -* [#1987](https://github.com/cmderdev/cmder/issues/1987) Use default files for default user profiles - -## [1.3.10](https://github.com/cmderdev/cmder/tree/v1.3.10) (2018-11-30) - -### Fixes - -* Replaces Cmder Release v1.3.9 which has been removed. -* /c now completely separates user config including Conemu configuration. This enables true multi-user Cmder with no configuration collisions. See PR #1949. -* Fix #1959 Start cmder "find" errors. See PR #1961. -* Fix #1956 Git detection should use env from git install root. See PR #1969 - -### Adds - -* /m initially creates %cmder_root%/config/conemu-%computername%.xml for users that want per computer Conemu configuration with shared init scripts. See PR #1949. -* /register now recognizes /c [path] and creates an appropriate Cmder Here shell context menu. See PR #1949. - -## [1.3.8](https://github.com/cmderdev/cmder/tree/v1.3.8) (2018-11-10) - -### Fixes - -* Fix \vendor\bin\timer.cmd was unexpected at this time. on session start. - -## [1.3.7](https://github.com/cmderdev/cmder/tree/v1.3.7) (2018-11-10) -## Updated components - -* ConEmu to 180626 -* Update Git to 2.19.0 - -## Fixes: - -* Cmder now opens in the in the current working dir - -## Commits -### Aaron Arney (1): - -* Update README - -### Arion Roberto Krause (1): - -* Fixed typo - -### Benjamin Staneck (8): - -* Revert "replace user-aliases with user_aliases" -* replace user-aliases with user_aliases -* better fix for #1265 -* Revert "sanitize dir before assigning to prompt" -* sanitize dir before assigning to prompt -* Update CHANGELOG.md - -### Bob Hood (1): - -* Refactored the Mercurial prompt code to be more efficient. - -### David Refoua (1): - -* fix some spelling issues - -### Dax T Games (30): - -* Revert "Ignore %cmder_root%\config (#1945)" -* Ignore %cmder_root%\config (#1945) -* Add /f for fast init. (#1942) -* add diag helper scripts and adds to the path (#1918) -* Fix #1806 #1675 (#1870) -* Profile.ps1 (#1796) -* Fix lib base (#1794) -* Little Changes -* Fixed move of default conemu.xml to the vendor folder -* ignore all of config folder -* move default comemu.xml to vendor folder -* fixes -* more headers -* init.bat update for cexec -* git prompt yellow -* fix user lua and git detection -* allow conditionally setting environment variables -* added exit codes -* flag_exists.cmd to flag_exec.cmd, also to lib as an option -* fixed -* handle start dir args with trailing " -* cleanup -* '.gitignore' -* verbose output -* cmder_shell settings -* add cmder_shell method -* replace - with \_ in debug-output and verbose-output -* Trying to get tcc working -* move user-aliases.cmd to user_aliases.cmd -* move bin\alias.bat to vendor\bin\alias.cmd -* fix /unregister - -### Dmitri S. Guskov (2): - -* Powershell 5.1 compatibility -* Update profile.ps1 - -### Gregory Lucas (1): - -* Initialize time_init to fix init error message - -### Josef Pihrt (2): - -* Fix typos, remove escaping inside inline code, replace single quote with backtick -* Fix typo and broken link - -### Merlin (1): - -* Remove duplicate Install-Module detection - -### Nicolas Arnaud-Cormos (1): - -* Ensure the right git path is found in case of shim. - -### Thorsten Sommer (1): - -* Fixed spelling - -### gaoslin (1): - -* Update init.bat - -### leochien0102 (1): - -* fix the 'was unexpected at this time.' - -### xiazeyu (4): - -* chore: unite slash -* docs: update to latest useage -* refactor: reduce global varible useage, fixed quote issue, added parameters support -* doc: fix typo - -### xiazeyu_2011 (8): - -* docs: migrated instructions to the wiki pages -* rename /bin/have.bat to /vendor/lib/flag_exists.cmd -* fix: bug when no argument is passed in -* docs: update doc for have.bat -* feat: add have.bat as a wrapper -* Optimize comments of using arguments in user-profile.cmd -* fix conflict with init.bat build-in command parser, update user-profile.cmd -* Pass arguments to user-profile.cmd - -刘祺 (1): - -* add LANG support - ## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30) - **Updated components:** * Git updated to v2.17.1.windows.2 * ConEmu updated to 180528 -**Updates:** - - * Cmder now opens in the in the current working dir +**Updates:** + +* Cmder now opens in the in the current working dir +* TBD ## [1.3.6-pre2](https://github.com/cmderdev/cmder/tree/v1.3.6-pre2) (2018-03-01) From 4f2ced57df27f29cbc2013d88a3532f96be68031 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 22 Dec 2018 16:55:56 -0500 Subject: [PATCH 098/371] Revert "fix sshagent call in user_profile.cmd.default" --- vendor/user_profile.cmd.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/user_profile.cmd.default b/vendor/user_profile.cmd.default index e5966e0..aa5f4f8 100644 --- a/vendor/user_profile.cmd.default +++ b/vendor/user_profile.cmd.default @@ -2,7 +2,7 @@ :: use in front of the command to prevent printing the command :: uncomment this to have the ssh agent load when cmder starts -:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" /k exit +:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" :: uncomment the next two lines to use pageant as the ssh authentication agent :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock @@ -16,4 +16,4 @@ :: %ccall% "/customOption" "command/program" -@echo off +@echo off \ No newline at end of file From 9a47bce6ac3b4bc52342830c8d128288ddabe8f8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 22 Dec 2018 17:05:08 -0500 Subject: [PATCH 099/371] fix ssh-agent in user_profile.cmd.default --- CHANGELOG.md | 168 ++++++++++++++++++++++++++++++++ vendor/user_profile.cmd.default | 4 +- 2 files changed, 170 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf7120..93d6bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,173 @@ # Change Log +## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) + +### Fixes + +* Fix uncommenting `call ssh-agent` in `user_profile.cmd` breaks Cmder prompt. [#1990](https://github.com/cmderdev/cmder/issues/1990), [#1807](https://github.com/cmderdev/cmder/issues/1807), [#1785](https://github.com/cmderdev/cmder/issues/1785), [#1885](https://github.com/cmderdev/cmder/issues/1885) + * Pull Request: [#1995](https://github.com/cmderdev/cmder/issues/1995) fix sshagent call in user_profile.cmd.default +* Unable to use '%' character in git branch names [#1779](https://github.com/cmderdev/cmder/issues/1779) + * Pull Request: [#1991](https://github.com/cmderdev/cmder/issues/1991) add percent escaping for string.gsub +* sort command, unix vs windows (/usr/bin/sort vs sort.exe) [#1931](https://github.com/cmderdev/cmder/issues/1931) + * Pull Request: [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option + +### Adds + +* [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option +* [#1982](https://github.com/cmderdev/cmder/issues/1982) make /register work with /single +* [#1975](https://github.com/cmderdev/cmder/issues/1975) Add `/nix_tools 0` option to init.bat to prevent adding !GIT_INSTALL_ROOT!\usr\bin to PATH + + +### Changes + +* [#1987](https://github.com/cmderdev/cmder/issues/1987) Use default files for default user profiles + +## [1.3.10](https://github.com/cmderdev/cmder/tree/v1.3.10) (2018-11-30) + +### Fixes + +* Replaces Cmder Release v1.3.9 which has been removed. +* /c now completely separates user config including Conemu configuration. This enables true multi-user Cmder with no configuration collisions. See PR #1949. +* Fix #1959 Start cmder "find" errors. See PR #1961. +* Fix #1956 Git detection should use env from git install root. See PR #1969 + +### Adds + +* /m initially creates %cmder_root%/config/conemu-%computername%.xml for users that want per computer Conemu configuration with shared init scripts. See PR #1949. +* /register now recognizes /c [path] and creates an appropriate Cmder Here shell context menu. See PR #1949. + +## [1.3.8](https://github.com/cmderdev/cmder/tree/v1.3.8) (2018-11-10) + +### Fixes + +* Fix \vendor\bin\timer.cmd was unexpected at this time. on session start. + +## [1.3.7](https://github.com/cmderdev/cmder/tree/v1.3.7) (2018-11-10) +## Updated components + +* ConEmu to 180626 +* Update Git to 2.19.0 + +## Fixes: + +* Cmder now opens in the in the current working dir + +## Commits +### Aaron Arney (1): + +* Update README + +### Arion Roberto Krause (1): + +* Fixed typo + +### Benjamin Staneck (8): + +* Revert "replace user-aliases with user_aliases" +* replace user-aliases with user_aliases +* better fix for #1265 +* Revert "sanitize dir before assigning to prompt" +* sanitize dir before assigning to prompt +* Update CHANGELOG.md + +### Bob Hood (1): + +* Refactored the Mercurial prompt code to be more efficient. + +### David Refoua (1): + +* fix some spelling issues + +### Dax T Games (30): + +* Revert "Ignore %cmder_root%\config (#1945)" +* Ignore %cmder_root%\config (#1945) +* Add /f for fast init. (#1942) +* add diag helper scripts and adds to the path (#1918) +* Fix #1806 #1675 (#1870) +* Profile.ps1 (#1796) +* Fix lib base (#1794) +* Little Changes +* Fixed move of default conemu.xml to the vendor folder +* ignore all of config folder +* move default comemu.xml to vendor folder +* fixes +* more headers +* init.bat update for cexec +* git prompt yellow +* fix user lua and git detection +* allow conditionally setting environment variables +* added exit codes +* flag_exists.cmd to flag_exec.cmd, also to lib as an option +* fixed +* handle start dir args with trailing " +* cleanup +* '.gitignore' +* verbose output +* cmder_shell settings +* add cmder_shell method +* replace - with \_ in debug-output and verbose-output +* Trying to get tcc working +* move user-aliases.cmd to user_aliases.cmd +* move bin\alias.bat to vendor\bin\alias.cmd +* fix /unregister + +### Dmitri S. Guskov (2): + +* Powershell 5.1 compatibility +* Update profile.ps1 + +### Gregory Lucas (1): + +* Initialize time_init to fix init error message + +### Josef Pihrt (2): + +* Fix typos, remove escaping inside inline code, replace single quote with backtick +* Fix typo and broken link + +### Merlin (1): + +* Remove duplicate Install-Module detection + +### Nicolas Arnaud-Cormos (1): + +* Ensure the right git path is found in case of shim. + +### Thorsten Sommer (1): + +* Fixed spelling + +### gaoslin (1): + +* Update init.bat + +### leochien0102 (1): + +* fix the 'was unexpected at this time.' + +### xiazeyu (4): + +* chore: unite slash +* docs: update to latest useage +* refactor: reduce global varible useage, fixed quote issue, added parameters support +* doc: fix typo + +### xiazeyu_2011 (8): + +* docs: migrated instructions to the wiki pages +* rename /bin/have.bat to /vendor/lib/flag_exists.cmd +* fix: bug when no argument is passed in +* docs: update doc for have.bat +* feat: add have.bat as a wrapper +* Optimize comments of using arguments in user-profile.cmd +* fix conflict with init.bat build-in command parser, update user-profile.cmd +* Pass arguments to user-profile.cmd + +刘祺 (1): + +* add LANG support + ## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30) **Updated components:** diff --git a/vendor/user_profile.cmd.default b/vendor/user_profile.cmd.default index aa5f4f8..e5966e0 100644 --- a/vendor/user_profile.cmd.default +++ b/vendor/user_profile.cmd.default @@ -2,7 +2,7 @@ :: use in front of the command to prevent printing the command :: uncomment this to have the ssh agent load when cmder starts -:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" +:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" /k exit :: uncomment the next two lines to use pageant as the ssh authentication agent :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock @@ -16,4 +16,4 @@ :: %ccall% "/customOption" "command/program" -@echo off \ No newline at end of file +@echo off From 46bde1af8b6206e61b0b3f828d8742a75ec842fb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 22 Dec 2018 17:07:31 -0500 Subject: [PATCH 100/371] fix ssh-agent in user_profile.cmd.default --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93d6bbb..a66ff3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Fixes * Fix uncommenting `call ssh-agent` in `user_profile.cmd` breaks Cmder prompt. [#1990](https://github.com/cmderdev/cmder/issues/1990), [#1807](https://github.com/cmderdev/cmder/issues/1807), [#1785](https://github.com/cmderdev/cmder/issues/1785), [#1885](https://github.com/cmderdev/cmder/issues/1885) - * Pull Request: [#1995](https://github.com/cmderdev/cmder/issues/1995) fix sshagent call in user_profile.cmd.default + * Pull Request: [#1999](https://github.com/cmderdev/cmder/issues/1999) fix ssh-agent call in user_profile.cmd.default * Unable to use '%' character in git branch names [#1779](https://github.com/cmderdev/cmder/issues/1779) * Pull Request: [#1991](https://github.com/cmderdev/cmder/issues/1991) add percent escaping for string.gsub * sort command, unix vs windows (/usr/bin/sort vs sort.exe) [#1931](https://github.com/cmderdev/cmder/issues/1931) From 5a48e568a80a1977ffb0ffbda98c2393a7b7fb4c Mon Sep 17 00:00:00 2001 From: b0bh00d Date: Tue, 1 Jan 2019 11:17:53 -0700 Subject: [PATCH 101/371] Updated the HG prompt code to use the '-ib' option to 'hg id' to always have the branch name available. --- vendor/clink.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 2530510..a949b55 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -324,15 +324,19 @@ local function hg_prompt_filter() dirty = "\x1b[31;1m", } - -- 'hg id' gives us BOTH the branch name AND an indicator that there - -- are uncommitted changes, in one fast(er) call - local pipe = io.popen("hg id 2>&1") + -- 'hg id -ib' gives us BOTH the branch name AND an indicator that there + -- are uncommitted changes, in one fast(er) call compared to "hg status" + local pipe = io.popen("hg id -ib 2>&1") local output = pipe:read('*all') local rc = { pipe:close() } + -- strip the trailing newline from the branch name + local n = #output + while n > 0 and output:find("^%s", n) do n = n - 1 end + output = output:sub(1, n) + if output ~= nil and string.sub(output,1,7) ~= "abort: " and -- not an HG working copy - string.sub(output,1,12) ~= "000000000000" and -- empty wc (needs update) (not string.find(output, "is not recognized")) then -- 'hg' not in path local color = colors.clean -- split elements on space delimiter @@ -342,8 +346,12 @@ local function hg_prompt_filter() end -- if the repo hash ends with '+', the wc has uncommitted changes if string.sub(items[1], -1, -1) == "+" then color = colors.dirty end - -- substitute the branch in directly -- already WITH parentheses. :) - result = color .. items[2] -- string.sub(items[2], 1, string.len(items[2]) - 1) + -- substitute the branch in directly + if items[2] ~= nil then + result = color .. "(" .. items[2] .. ")" + else + result = color .. "*" + end end end From 961f38a399fdc54e5fd3294541b73669b027ec41 Mon Sep 17 00:00:00 2001 From: Bob Hood Date: Sat, 5 Jan 2019 11:56:30 -0700 Subject: [PATCH 102/371] Updated the HG prompt (#2002) Per our email discussion, I have updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy. --- vendor/clink.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 2530510..a949b55 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -324,15 +324,19 @@ local function hg_prompt_filter() dirty = "\x1b[31;1m", } - -- 'hg id' gives us BOTH the branch name AND an indicator that there - -- are uncommitted changes, in one fast(er) call - local pipe = io.popen("hg id 2>&1") + -- 'hg id -ib' gives us BOTH the branch name AND an indicator that there + -- are uncommitted changes, in one fast(er) call compared to "hg status" + local pipe = io.popen("hg id -ib 2>&1") local output = pipe:read('*all') local rc = { pipe:close() } + -- strip the trailing newline from the branch name + local n = #output + while n > 0 and output:find("^%s", n) do n = n - 1 end + output = output:sub(1, n) + if output ~= nil and string.sub(output,1,7) ~= "abort: " and -- not an HG working copy - string.sub(output,1,12) ~= "000000000000" and -- empty wc (needs update) (not string.find(output, "is not recognized")) then -- 'hg' not in path local color = colors.clean -- split elements on space delimiter @@ -342,8 +346,12 @@ local function hg_prompt_filter() end -- if the repo hash ends with '+', the wc has uncommitted changes if string.sub(items[1], -1, -1) == "+" then color = colors.dirty end - -- substitute the branch in directly -- already WITH parentheses. :) - result = color .. items[2] -- string.sub(items[2], 1, string.len(items[2]) - 1) + -- substitute the branch in directly + if items[2] ~= nil then + result = color .. "(" .. items[2] .. ")" + else + result = color .. "*" + end end end From 2a4e9d8301794946d8a5d44c7b1edf43845b3893 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 6 Jan 2019 17:27:04 -0500 Subject: [PATCH 103/371] workaround vscode tasks showing cmder debug output --- vendor/init.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index d670e84..b525daa 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -51,7 +51,9 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1"=="/v" ( set verbose_output=1 ) else if /i "%1"=="/d" ( - set debug_output=1 + if not defined VSCODE_CWD ( + set debug_output=1 + ) ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" From 6d8f7a290abfef5d997357b313aa089719c6a81c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 6 Jan 2019 17:46:50 -0500 Subject: [PATCH 104/371] ignore all args if running inside vscode --- vendor/init.bat | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index b525daa..fc6402d 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -41,6 +41,9 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" +if defined VSCODE_CWD ( + goto start +) :var_loop if "%~1" == "" ( goto :start @@ -51,9 +54,7 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1"=="/v" ( set verbose_output=1 ) else if /i "%1"=="/d" ( - if not defined VSCODE_CWD ( - set debug_output=1 - ) + set debug_output=1 ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" From 760f4e579e3feaad76b4a77c08d7d7c54dd65a4f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 6 Jan 2019 18:09:06 -0500 Subject: [PATCH 105/371] ignore all /d arg if running inside vscode --- vendor/init.bat | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index fc6402d..b525daa 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -41,9 +41,6 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" -if defined VSCODE_CWD ( - goto start -) :var_loop if "%~1" == "" ( goto :start @@ -54,7 +51,9 @@ if defined VSCODE_CWD ( ) else if /i "%1"=="/v" ( set verbose_output=1 ) else if /i "%1"=="/d" ( - set debug_output=1 + if not defined VSCODE_CWD ( + set debug_output=1 + ) ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" From 89499f2a6068980256ca1132714407fdbcdc282a Mon Sep 17 00:00:00 2001 From: b0bh00d Date: Sun, 20 Jan 2019 21:02:31 -0700 Subject: [PATCH 106/371] Replaced the 'hg -id' command with the 'hg branch' and 'hg status' pair for improved response times. --- vendor/clink.lua | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index a949b55..d5f6876 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -324,34 +324,26 @@ local function hg_prompt_filter() dirty = "\x1b[31;1m", } - -- 'hg id -ib' gives us BOTH the branch name AND an indicator that there - -- are uncommitted changes, in one fast(er) call compared to "hg status" - local pipe = io.popen("hg id -ib 2>&1") + local pipe = io.popen("hg branch 2>&1") local output = pipe:read('*all') local rc = { pipe:close() } -- strip the trailing newline from the branch name local n = #output while n > 0 and output:find("^%s", n) do n = n - 1 end - output = output:sub(1, n) + local branch = output:sub(1, n) - if output ~= nil and - string.sub(output,1,7) ~= "abort: " and -- not an HG working copy - (not string.find(output, "is not recognized")) then -- 'hg' not in path + if branch ~= nil and + string.sub(branch,1,7) ~= "abort: " and -- not an HG working copy + (not string.find(branch, "is not recognized")) then -- 'hg' not in path local color = colors.clean - -- split elements on space delimiter - local items = {} - for i in string.gmatch(output, "%S+") do - table.insert(items, i) - end - -- if the repo hash ends with '+', the wc has uncommitted changes - if string.sub(items[1], -1, -1) == "+" then color = colors.dirty end - -- substitute the branch in directly - if items[2] ~= nil then - result = color .. "(" .. items[2] .. ")" - else - result = color .. "*" - end + + local pipe = io.popen("hg status -amrd 2>&1") + local output = pipe:read('*all') + local rc = { pipe:close() } + + if output ~= nil and output ~= "" then color = colors.dirty end + result = color .. "(" .. branch .. ")" end end From 06e6c63b7fcf36e90bef4fcd51eb8b9092ec44cc Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Mon, 18 Feb 2019 11:41:11 -0500 Subject: [PATCH 107/371] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3a91106..d624972 100644 --- a/README.md +++ b/README.md @@ -312,11 +312,11 @@ For instructions on how to integrate Cmder with your IDE, please read our [Wiki The process of upgrading Cmder depends on the version/build you are currently running. -If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer version of Cmder, follow the below process: +If you have a `[cmder_root]/config/user[-|_]conemu.xml`, you are running a newer version of Cmder, follow the below process: -1. Exit all Cmder sessions and relaunch `[cmder_root]/cmder.exe`, this backs up your existing `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`. +1. Exit all Cmder sessions and relaunch `[cmder_root]/cmder.exe`, this backs up your existing `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user[-|_]conemu.xml`. - * The `[cmder_root]/config/user-conemu.xml` contains any custom settings you have made using the 'Setup Tasks' settings dialog. + * The `[cmder_root]/config/user[-|_]conemu.xml` contains any custom settings you have made using the 'Setup Tasks' settings dialog. 2. Exit all Cmder sessions and backup any files you have manually edited under `[cmder_root]/vendor`. @@ -325,9 +325,9 @@ If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer ver 3. Delete the `[cmder_root]/vendor` folder. 4. Extract the new `cmder.zip` or `cmder_mini.zip` into `[cmder_root]/` overwriting all files when prompted. -If you do not have a `[cmder_root]/config/user-conemu.xml`, you are running an older version of cmder, follow the below process: +If you do not have a `[cmder_root]/config/user[-|_]conemu.xml`, you are running an older version of cmder, follow the below process: -1. Exit all Cmder sessions and backup `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`. +1. Exit all Cmder sessions and backup `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user[-|_]conemu.xml`. 2. Backup any files you have manually edited under `[cmder_root]/vendor`. From 20d55c1469d39cd034c6210050f69dd9d69e717d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 28 Feb 2019 17:37:45 -0500 Subject: [PATCH 108/371] all clink disable by setting CMDER_CLINK=0 befor starting task --- vendor/lib/lib_base.cmd | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 8577637..38112ae 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -65,12 +65,17 @@ exit /b echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" echo %comspec% | find /i "\tccle" > nul && set "CMDER_SHELL=tccle" - set CMDER_CLINK=1 - if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 - if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 + if not defined CMDER_CLINK ( + set CMDER_CLINK=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 + ) - set CMDER_ALIASES=1 - if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 - if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 + + if not defined CMDER_ALIASES ( + set CMDER_ALIASES=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 + ) exit /b From cc12b848ac42ed58b08768ed198425b464f8b356 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 28 Feb 2019 17:44:28 -0500 Subject: [PATCH 109/371] provide default settings for clink that updates the history file in real time --- vendor/clink_settings.default | 116 ++++++++++++++++++++++++++++++++++ vendor/init.bat | 2 + 2 files changed, 118 insertions(+) create mode 100644 vendor/clink_settings.default diff --git a/vendor/clink_settings.default b/vendor/clink_settings.default new file mode 100644 index 0000000..021a78d --- /dev/null +++ b/vendor/clink_settings.default @@ -0,0 +1,116 @@ +# name: Pressing Ctrl-D exits session +# type: bool +# Ctrl-D exits cmd.exe when it is pressed on an empty line. +ctrld_exits = 1 + +# name: Toggle if pressing Esc clears line +# type: bool +# Clink clears the current line when Esc is pressed (unless Readline's Vi mode +# is enabled). +esc_clears_line = 1 + +# name: Match display colour +# type: int +# Colour to use when displaying matches. A value less than 0 will be the +# opposite brightness of the default colour. +match_colour = -1 + +# name: Executable match style +# type: enum +# 0 = PATH only +# 1 = PATH and CWD +# 2 = PATH, CWD, and directories +# Changes how Clink will match executables when there is no path separator on +# the line. 0 = PATH only, 1 = PATH and CWD, 2 = PATH, CWD, and directories. In +# all cases both executables and directories are matched when there is a path +# separator present. A value of -1 will disable executable matching completely. +exec_match_style = 2 + +# name: Whitespace prefix matches files +# type: bool +# If the line begins with whitespace then Clink bypasses executable matching and +# will match all files and directories instead. +space_prefix_match_files = 1 + +# name: Colour of the prompt +# type: int +# Surrounds the prompt in ANSI escape codes to set the prompt's colour. Disabled +# when the value is less than 0. +prompt_colour = -1 + +# name: Auto-answer terminate prompt +# type: enum +# 0 = Disabled +# 1 = Answer 'Y' +# 2 = Answer 'N' +# Automatically answers cmd.exe's 'Terminate batch job (Y/N)?' prompts. 0 = +# disabled, 1 = answer 'Y', 2 = answer 'N'. +terminate_autoanswer = 0 + +# name: Lines of history saved to disk +# type: int +# When set to a positive integer this is the number of lines of history that +# will persist when Clink saves the command history to disk. Use 0 for infinite +# lines and <0 to disable history persistence. +history_file_lines = 10000 + +# name: Skip adding lines prefixed with whitespace +# type: bool +# Ignore lines that begin with whitespace when adding lines in to the history. +history_ignore_space = 0 + +# name: Controls how duplicate entries are handled +# type: enum +# 0 = Always add +# 1 = Ignore +# 2 = Erase previous +# If a line is a duplicate of an existing history entry Clink will erase the +# duplicate when this is set 2. A value of 1 will not add duplicates to the +# history and a value of 0 will always add lines. Note that history is not +# deduplicated when reading/writing to disk. +history_dupe_mode = 2 + +# name: Read/write history file each line edited +# type: bool +# When non-zero the history will be read from disk before editing a new line and +# written to disk afterwards. +history_io = 1 + +# name: Sets how command history expansion is applied +# type: enum +# 0 = Off +# 1 = On +# 2 = Not in single quotes +# 3 = Not in double quote +# 4 = Not in any quotes +# The '!' character in an entered line can be interpreted to introduce words +# from the history. This can be enabled and disable by setting this value to 1 +# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double, +# or both quotes respectively. +history_expand_mode = 4 + +# name: Support Windows' Ctrl-Alt substitute for AltGr +# type: bool +# Windows provides Ctrl-Alt as a substitute for AltGr, historically to support +# keyboards with no AltGr key. This may collide with some of Readline's +# bindings. +use_altgr_substitute = 1 + +# name: Strips CR and LF chars on paste +# type: enum +# 0 = Paste unchanged +# 1 = Strip +# 2 = As space +# Setting this to a value >0 will make Clink strip CR and LF characters from +# text pasted into the current line. Set this to 1 to strip all newline +# characters and 2 to replace them with a space. +strip_crlf_on_paste = 2 + +# name: Enables basic ANSI escape code support +# type: bool +# When printing the prompt, Clink has basic built-in support for SGR ANSI escape +# codes to control the text colours. This is automatically disabled if a third +# party tool is detected that also provides this facility. It can also be +# disabled by setting this to 0. +ansi_code_support = 1 + diff --git a/vendor/init.bat b/vendor/init.bat index 8a4d71a..fd03870 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -122,12 +122,14 @@ if "%CMDER_CLINK%" == "1" ( if defined CMDER_USER_CONFIG ( if not exist "%CMDER_USER_CONFIG%\settings" ( echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ ) "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" ) else ( if not exist "%CMDER_ROOT%\config\settings" ( echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" From 7bd25e95e13f1a17345cd24bd25f1db34eebf35b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 28 Feb 2019 17:55:16 -0500 Subject: [PATCH 110/371] upgrade git to 2.21.0 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 72696ce..b8f3f8a 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.19.0.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.19.0.windows.1/PortableGit-2.19.0-64-bit.7z.exe" + "version": "v2.21.0.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/PortableGit-2.21.0-64-bit.7z.exe" }, { "name": "clink", From 8ec252276fc374ad417e0909437448cf2c6d766d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 28 Feb 2019 18:13:19 -0500 Subject: [PATCH 111/371] changelog --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a66ff3b..34ae8ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Change Log +## [Unreleased] + +### Fixes + +* Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002) + * Updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy + +### Changes + +* Pull Request: [#2055](https://github.com/cmderdev/cmder/pull/2055) + * Upgrade git to 2.21.0 + * Provide default settings for Clink that updates the history file in real time + * Turn this on in existing Cmder using `clink set history_io 1` + * Allow clink disable by setting CMDER_CLINK=0 before starting task + ## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) ### Fixes From 63128ed52fd1245a8565bb9a29ce377895550eac Mon Sep 17 00:00:00 2001 From: David Refoua Date: Thu, 7 Mar 2019 16:59:46 +0330 Subject: [PATCH 112/371] =?UTF-8?q?=E2=9C=A8=20polished=20issues=20templat?= =?UTF-8?q?e=20(#2056)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - added version subsection - better worded upstream technologies notice - more clear instructions --- .github/issue_template.md | 54 ++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 5ebdb9c..21b489a 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -10,16 +10,18 @@ • Searched for existing issues (including the **closed** ones) for the similar problems here: + https://github.com/cmderdev/cmder/issues?q=is:issue - • Read the README.md and the Wiki: + • Read both the README.md and the Wiki: + - https://github.com/cmderdev/cmder/blob/master/README.md - https://github.com/cmderdev/cmder/wiki (What you may be asking here could already be explained there!) - • Please understand that Cmder by default uses ConEmu as the - underlying Terminal Emulator. If your issue is regarding + • Please understand that Cmder uses ConEmu as the default + underlying Terminal Emulator. If your issue is regarding the **Terminal Emulator**, please visit the ConEmu issues page: https://github.com/Maximus5/ConEmu/issues?q=is:issue @@ -30,35 +32,53 @@ make sure you open the issue in the correct place.) more info: https://conemu.github.io/en/ThirdPartyProblems.html - - • If you are asking for guides on how to integrate Cmder into - your favorite IDE of choice, or how to perform an specific - task with Cmder, make sure you visit our label section first! + + • If you would like to ask for guides on how to integrate Cmder with + your favorite IDE of choice, or how to perform a specific task + with Cmder, make sure you visit our label section first. + You may already have an answer under the Guides or Questions section. For a list of labels, visit: - https://github.com/cmderdev/cmder/labels (Be sure to also check “Closed” issues in the labels section!) + + • If you are having an issue with any of the **upstream technologies** + that are used by Cmder, please make sure that the issue is reproducible + _only_ when used in combination with Cmder. + + We may not directly address the issues related to the following tools: + - Clink, the default shell in Cmder + - ConEmu, the terminal emulator + - Git/MinGW, which also provide *NIX tools + - clink-completions, which provide autocomplete + + The issues related to upstream technologies are marked as 👆 [name]. + + We'll try our best to help you -- but we recommend creating an issue + specifically at each of the corresponding repositories for the best + result. + + ► Try to reproduce the bug you're reporting, on a stand-alone edition + of each tool, without using Cmder. If the bug applies when the + mentioned tools are NOT used within Cmder, there's a good chance that + you should open the bug at the corresponding repo instead. - • If the issue is regarding the other upstream technologies that - Cmder uses (e.g. Clink, Git, etc), please make sure that the - bug you are reporting only applies when they are used in - combination with Cmder. If the bug applies when the mentioned - tools are NOT used within Cmder, there's a good chance that - you should open the bug at the corresponding repo instead. + • Lastly, have a look at official documentation for Cmder over + our website, and our wiki. Read more on about Cmder on ConEmu docs: https://conemu.github.io/en/cmder.html - Thank you for making sure you are opening a new valid issue! + Thank you for making sure you are opening a new valid issue! ♥ --> @@ -74,5 +95,8 @@ - [ ] Feature request (request for new functionality) - [ ] Question +### Version Information + + ### Description of the issue From 98a64b71b24d0c5bdde26c73ddbc95523bc2a359 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Mar 2019 13:52:47 -0400 Subject: [PATCH 113/371] Allow full ps1 prompt customization by 'config/*.ps1' scripts --- vendor/profile.ps1 | 79 ++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 73fde18..498bdc0 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -27,7 +27,7 @@ $ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\")) # do not load bundled psget if a module installer is already available # -> recent PowerShell versions include PowerShellGet out of the box -$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null) +$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue) # Add Cmder modules directory to the autoload path. $CmderModulePath = Join-path $PSScriptRoot "psmodules/" @@ -96,31 +96,6 @@ $env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER # Users should modify their user_profile.ps1 as it will be safe from updates. # -# Pre assign the hooks so the first run of cmder gets a working prompt. -[ScriptBlock]$PrePrompt = {} -[ScriptBlock]$PostPrompt = {} -[ScriptBlock]$CmderPrompt = { - $Host.UI.RawUI.ForegroundColor = "White" - Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green - checkGit($pwd.ProviderPath) -} - -<# -This scriptblock runs every time the prompt is returned. -Explicitly use functions from MS namespace to protect from being overridden in the user session. -Custom prompt functions are loaded in as constants to get the same behaviour -#> -[ScriptBlock]$Prompt = { - $realLASTEXITCODE = $LASTEXITCODE - $host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf - PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline - CmderPrompt - Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray" - PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline - $global:LASTEXITCODE = $realLASTEXITCODE - return " " -} - # Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d" # to source them at startup. if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { @@ -154,7 +129,7 @@ if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profil } popd } - + # Renaming to "config\user_profile.ps1" to "user_profile.ps1" for consistency. if (test-path "$env:CMDER_ROOT\config\user-profile.ps1") { rename-item "$env:CMDER_ROOT\config\user-profile.ps1" user_profile.ps1 @@ -185,11 +160,47 @@ if (! (Test-Path $CmderUserProfilePath) ) { Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath } -# Once Created these code blocks cannot be overwritten -Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant -Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant -Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant +# Only set the prompt if it is currently set to the default +# This allows users to configure the prompt in their user_profile.ps1 or config\profile.d\*.ps1 +if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionState.Path.CurrentLocation\)\$\(' -and ` + $(get-command prompt).Definition -match '\(\$nestedPromptLevel \+ 1\)\) ";') { + # Pre assign the hooks so the first run of cmder gets a working prompt. + [ScriptBlock]$PrePrompt = {} + [ScriptBlock]$PostPrompt = {} + [ScriptBlock]$CmderPrompt = { + $Host.UI.RawUI.ForegroundColor = "White" + Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green + checkGit($pwd.ProviderPath) + } -# Functions can be made constant only at creation time -# ReadOnly at least requires `-force` to be overwritten -Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly + <# + This scriptblock runs every time the prompt is returned. + Explicitly use functions from MS namespace to protect from being overridden in the user session. + Custom prompt functions are loaded in as constants to get the same behaviour + #> + [ScriptBlock]$Prompt = { + $realLASTEXITCODE = $LASTEXITCODE + $host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf + PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline + CmderPrompt + Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray" + PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline + $global:LASTEXITCODE = $realLASTEXITCODE + return " " + } + + + # Once Created these code blocks cannot be overwritten + # if (-not $(get-command PrePrompt).Options -match 'Constant') {Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant} + # if (-not $(get-command CmderPrompt).Options -match 'Constant') {Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant} + # if (-not $(get-command PostPrompt).Options -match 'Constant') {Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant} + + Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant + Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant + Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant + + # Functions can be made constant only at creation time + # ReadOnly at least requires `-force` to be overwritten + # if (!$(get-command Prompt).Options -match 'ReadOnly') {Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly} + Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly +} From 8abfa9d4134a1ee0ff81eb9a2e8a8bfc209d6052 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Mar 2019 19:15:36 -0400 Subject: [PATCH 114/371] add back shell context menu to drives on register unregister --- launcher/src/CmderLauncher.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index d9e17c9..e399a47 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -20,6 +20,8 @@ #define MB_TITLE L"Cmder Launcher" #define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder" #define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder" +#define SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND L"Drive\\Background\\shell\\Cmder" +#define SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM L"Drive\\shell\\Cmder" #define streqi(a, b) (_wcsicmp((a), (b)) == 0) @@ -665,11 +667,15 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, { RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); + RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle); } else if (cmderOptions.unRegisterApp == true) { UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND); UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM); + UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND); + UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM); } else if (cmderOptions.error == true) { From a93fff6798ad5b4b7c4eda1d933cc8578cf24462 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sun, 17 Mar 2019 15:09:02 -0400 Subject: [PATCH 115/371] Update init.bat --- vendor/init.bat | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 20676f6..5cc29ab 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -51,9 +51,7 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1"=="/v" ( set verbose_output=1 ) else if /i "%1"=="/d" ( - if not defined VSCODE_CWD ( - set debug_output=1 - ) + set debug_output=1 ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" From 280bbfff1fd7e938bfe6e11f42cec6d8a8a74178 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Thu, 21 Mar 2019 01:27:13 +0330 Subject: [PATCH 116/371] update issue template (#2062) --- .github/issue_template.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 21b489a..2806b29 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -44,6 +44,11 @@ (Be sure to also check “Closed” issues in the labels section!) + • If you have a request to provide auto-complete support for a new tool, + please post your request here: + + https://github.com/vladimir-kotikov/clink-completions/issues + • If you are having an issue with any of the **upstream technologies** that are used by Cmder, please make sure that the issue is reproducible _only_ when used in combination with Cmder. @@ -52,9 +57,9 @@ - Clink, the default shell in Cmder - ConEmu, the terminal emulator - Git/MinGW, which also provide *NIX tools - - clink-completions, which provide autocomplete + - clink-completions, which provide autocompletion - The issues related to upstream technologies are marked as 👆 [name]. + The issues related to upstream technologies are labeled as 👆 [name]. We'll try our best to help you -- but we recommend creating an issue specifically at each of the corresponding repositories for the best @@ -78,7 +83,7 @@ + + ### Description of the issue From 081624d88e3bac96306451b1751b5c01c3c0cbde Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 23 Mar 2019 15:03:44 -0400 Subject: [PATCH 117/371] cleanup --- vendor/profile.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 498bdc0..53b4e5a 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -25,7 +25,7 @@ if (! $ENV:CMDER_ROOT ) { # Remove trailing '\' $ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\")) -# do not load bundled psget if a module installer is already available +# Do not load bundled psget if a module installer is already available # -> recent PowerShell versions include PowerShellGet out of the box $moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue) @@ -91,11 +91,6 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { # Enhance Path $env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT" -# -# Prompt Section -# Users should modify their user_profile.ps1 as it will be safe from updates. -# - # Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d" # to source them at startup. if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { @@ -160,6 +155,11 @@ if (! (Test-Path $CmderUserProfilePath) ) { Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath } +# +# Prompt Section +# Users should modify their user_profile.ps1 as it will be safe from updates. +# + # Only set the prompt if it is currently set to the default # This allows users to configure the prompt in their user_profile.ps1 or config\profile.d\*.ps1 if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionState.Path.CurrentLocation\)\$\(' -and ` From 192c2f4dd102140144db656a739da1f36226659d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 31 Mar 2019 09:47:50 -0400 Subject: [PATCH 118/371] fix git detection --- vendor/lib/lib_git.cmd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index bfbcdb2..02f156b 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -88,8 +88,11 @@ exit /b ::: [SCOPE]_BUILD Scoped Build version. :::------------------------------------------------------------------------------- - setlocal enabledelayedexpansion :: process a `x.x.x.xxxx.x` formatted string + set "%~1_MAJOR=" + set "%~1_MINOR=" + set "%~1_PATCH=" + set "%~1_BUILD=" %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" @@ -98,7 +101,6 @@ exit /b set "%~1_BUILD=%%D" ) - endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!" exit /b :validate_version From b424012a08f4645d5c61423867e9dcc0b7276fd5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 31 Mar 2019 09:48:58 -0400 Subject: [PATCH 119/371] make debug messages more verbose --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 20676f6..3907beb 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -235,7 +235,7 @@ 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_console% debug_output "Using vendored Git '!GIT_VERSION_VENDORED!' from '!GIT_INSTALL_ROOT!..." goto :CONFIGURE_GIT ) else ( goto :NO_GIT @@ -246,7 +246,7 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" ( goto :CONFIGURE_GIT :FOUND_GIT -%lib_console% debug_output "Using found Git from '%GIT_INSTALL_ROOT%..." +%lib_console% debug_output "Using found Git '!GIT_VERSION_USER!' from '%GIT_INSTALL_ROOT%..." goto :CONFIGURE_GIT :CONFIGURE_GIT From f39b921121f3c4c99741cc33ef6bb554f5b2a69d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 31 Mar 2019 16:11:14 -0400 Subject: [PATCH 120/371] fixes --- .github/issue_template.md | 54 ++++++++++++++++----------------- vendor/user_aliases.cmd.default | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 2806b29..e3fc4e5 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -2,86 +2,86 @@ Thank you for reporting a bug for the Cmder project! ------------------------------------------------------------------ - + Please make sure you read and follow the following instructions carefully before reporting bugs, and/or requesting new features. - + Make sure that you have: - + • Searched for existing issues (including the **closed** ones) for the similar problems here: - + https://github.com/cmderdev/cmder/issues?q=is:issue - + • Read both the README.md and the Wiki: - + - https://github.com/cmderdev/cmder/blob/master/README.md - https://github.com/cmderdev/cmder/wiki - + (What you may be asking here could already be explained there!) - + • Please understand that Cmder uses ConEmu as the default underlying Terminal Emulator. If your issue is regarding the **Terminal Emulator**, please visit the ConEmu issues page: - + https://github.com/Maximus5/ConEmu/issues?q=is:issue - + If there isn't an existing issue, you may open a new one there. - - (We don't resolve issues regarding ConEmu here, so please + + (We don't resolve issues regarding ConEmu here, so please make sure you open the issue in the correct place.) more info: https://conemu.github.io/en/ThirdPartyProblems.html - + • If you would like to ask for guides on how to integrate Cmder with your favorite IDE of choice, or how to perform a specific task with Cmder, make sure you visit our label section first. - + You may already have an answer under the Guides or Questions section. For a list of labels, visit: - https://github.com/cmderdev/cmder/labels (Be sure to also check “Closed” issues in the labels section!) - + • If you have a request to provide auto-complete support for a new tool, please post your request here: - + https://github.com/vladimir-kotikov/clink-completions/issues - + • If you are having an issue with any of the **upstream technologies** that are used by Cmder, please make sure that the issue is reproducible _only_ when used in combination with Cmder. - + We may not directly address the issues related to the following tools: - Clink, the default shell in Cmder - ConEmu, the terminal emulator - Git/MinGW, which also provide *NIX tools - clink-completions, which provide autocompletion - + The issues related to upstream technologies are labeled as 👆 [name]. - + We'll try our best to help you -- but we recommend creating an issue specifically at each of the corresponding repositories for the best result. - + ► Try to reproduce the bug you're reporting, on a stand-alone edition of each tool, without using Cmder. If the bug applies when the mentioned tools are NOT used within Cmder, there's a good chance that you should open the bug at the corresponding repo instead. - + • Lastly, have a look at official documentation for Cmder over our website, and our wiki. Read more on about Cmder on ConEmu docs: https://conemu.github.io/en/cmder.html - - + + Thank you for making sure you are opening a new valid issue! ♥ - + --> - -### Description of the issue +### Description of the issue diff --git a/vendor/user_aliases.cmd.default b/vendor/user_aliases.cmd.default index 5279705..4221684 100644 --- a/vendor/user_aliases.cmd.default +++ b/vendor/user_aliases.cmd.default @@ -9,7 +9,7 @@ gl=git log --oneline --all --graph --decorate $* ls=ls --show-control-chars -F --color $* pwd=cd clear=cls -history=cat -n %CMDER_ROOT%\config\.history +history=cat -n "%CMDER_ROOT%\config\.history" unalias=alias /d $1 vi=vim $* cmderr=cd /d "%CMDER_ROOT%" From 13de4924ca3ca0426db5bbb0febfc4a6ca91aeb5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 31 Mar 2019 16:47:36 -0400 Subject: [PATCH 121/371] make powershell use of bash commands more bash like --- vendor/profile.ps1 | 50 ++++++++++++++++++++------------- vendor/user_profile.ps1.default | 17 +++++++++++ 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 498bdc0..781cba6 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -36,26 +36,21 @@ if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderMod $env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;") } -try { - Get-command -Name "vim" -ErrorAction Stop >$null -} catch { - # # You could do this but it may be a little drastic and introduce a lot of - # # unix tool overlap with powershel unix like aliases - # $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\usr\bin") - # set-alias -name "vi" -value "vim" - # # I think the below is safer. +function Configure-Git($GIT_INSTALL_ROOT){ + $env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd") - new-alias -name "vim" -value $($ENV:CMDER_ROOT + "\vendor\git-for-windows\usr\bin\vim.exe") - new-alias -name "vi" -value vim -} - -try { - # Check if git is on PATH, i.e. Git already installed on system - Get-command -Name "git" -ErrorAction Stop >$null -} catch { - $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\cmd") - # for bash.exe, which in the cmd version is found as \usr\bin\bash.exe - $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\bin") + # Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already + $GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\') + if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { + $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" + } + + # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already + if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { + $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" + } elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) { + $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin" + } } $gitLoaded = $false @@ -84,6 +79,19 @@ function checkGit($Path) { } } +try { + # Check if git is on PATH, i.e. Git already installed on system + Get-command -Name "git" -ErrorAction Stop >$null +} catch { + if (test-path "$env:CMDER_ROOT\vendor\git-for-windows") { + Configure-Git "$env:CMDER_ROOT\vendor\git-for-windows" + } +} + +if ( Get-command -Name "vim" -ErrorAction silentlycontinue) { + new-alias -name "vi" -value vim +} + if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { Set-PSReadlineOption -ExtraPromptLineCount 1 } @@ -170,7 +178,9 @@ if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionS [ScriptBlock]$CmderPrompt = { $Host.UI.RawUI.ForegroundColor = "White" Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green - checkGit($pwd.ProviderPath) + if (get-command git -erroraction silentlycontinue) { + checkGit($pwd.ProviderPath) + } } <# diff --git a/vendor/user_profile.ps1.default b/vendor/user_profile.ps1.default index b85ebee..27cc47b 100644 --- a/vendor/user_profile.ps1.default +++ b/vendor/user_profile.ps1.default @@ -23,3 +23,20 @@ ## +# Delete default powershell aliases that conflict with bash commands +# If you prefer the powershell aliases remove this. +if (get-command git) { + del -force alias:cat + del -force alias:clear + del -force alias:cp + del -force alias:diff + del -force alias:echo + del -force alias:kill + del -force alias:ls + del -force alias:mv + del -force alias:ps + del -force alias:pwd + del -force alias:rm + del -force alias:sleep + del -force alias:tee +} From a813e359c5c75d819b6c166c40c968dc2037101e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 09:09:32 -0400 Subject: [PATCH 122/371] don't delete aliases by default but provide an easy way for users to do so. --- vendor/bin/alias.cmd | 46 ++++++++++++++++++++++++++------- vendor/user_profile.ps1.default | 33 ++++++++++++----------- 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 1a1739d..8e10d1d 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -48,6 +48,9 @@ goto parseargument set _x=%* ) ) + +echo _x=%_x% + rem #endregion parseargument if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( @@ -63,18 +66,41 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( ) ) -:: validate alias -for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( - set alias_name=%%G - set alias_value=%%H +:: create with multiple parameters +if [%1] == [create] ( + if not [%2] == [] ( + if not [%3] == [] ( + set _x=%1=%2 + :: if command create was submitted + set alias_name=%~2 + shift + shift + echo %* + set alias_value=%* + + for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( + set alias_name=%%H + set alias_value=%%I + ) + ) + ) +) else ( + :: validate alias + echo %_x% + set x=!_x:%=^^%! + echo !_x! + for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( + set alias_name=%%G + set alias_value=%%H + ) + + :: leading quotes added while validating + set alias_name=!alias_name:~1! + + :: trailing quotes added while validating + set alias_value=!alias_value:~1,-1! ) -:: leading quotes added while validating -set alias_name=%alias_name:~1% - -:: trailing quotes added while validating -set alias_value=%alias_value:~0,-1% - ::remove spaces set _temp=%alias_name: =% diff --git a/vendor/user_profile.ps1.default b/vendor/user_profile.ps1.default index 27cc47b..8ed5b81 100644 --- a/vendor/user_profile.ps1.default +++ b/vendor/user_profile.ps1.default @@ -23,20 +23,19 @@ ## -# Delete default powershell aliases that conflict with bash commands -# If you prefer the powershell aliases remove this. -if (get-command git) { - del -force alias:cat - del -force alias:clear - del -force alias:cp - del -force alias:diff - del -force alias:echo - del -force alias:kill - del -force alias:ls - del -force alias:mv - del -force alias:ps - del -force alias:pwd - del -force alias:rm - del -force alias:sleep - del -force alias:tee -} +# # Delete default powershell aliases that conflict with bash commands +# if (get-command git) { +# del -force alias:cat +# del -force alias:clear +# del -force alias:cp +# del -force alias:diff +# del -force alias:echo +# del -force alias:kill +# del -force alias:ls +# del -force alias:mv +# del -force alias:ps +# del -force alias:pwd +# del -force alias:rm +# del -force alias:sleep +# del -force alias:tee +# } From 3e40c803311292055e2e74132d184706b5d19e4f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 16:58:45 -0400 Subject: [PATCH 123/371] new alias create syntax --- vendor/bin/alias.cmd | 82 +++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 20 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 1a1739d..ee64ad4 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -14,6 +14,8 @@ if "%~1" == "" echo Use /? for help & echo. & goto :p_show rem #region parseargument goto parseargument +set args= + :do_shift shift @@ -22,10 +24,15 @@ goto parseargument if /i "%currentarg%" equ "/f" ( set ALIASES=%~2 + set ALT_ALIASES=%~2 shift goto :do_shift ) else if /i "%currentarg%" == "/reload" ( goto :p_reload + ) else if "%currentarg%" equ "/H" ( + goto :p_help + ) else if "%currentarg%" equ "/h" ( + goto :p_help ) else if "%currentarg%" equ "/?" ( goto :p_help ) else if /i "%currentarg%" equ "/d" ( @@ -43,11 +50,28 @@ goto parseargument doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b echo insufficient parameters. goto :p_help + ) else if "%currentarg%" == "create" ( + set action=create + if [%ALT_ALIASES%] neq [] ( + echo 1 + for /f "tokens=1,2,3,* usebackq" %%G in (`echo %*`) do ( + set args=%%J + ) + ) else ( + echo 2 + for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( + set args=%%H %%I + ) + ) ) else ( :: handle quotes within command definition, e.g. quoted long file names set _x=%* ) ) + +:: echo _x=%_x% +:: echo args=%args% + rem #endregion parseargument if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( @@ -63,25 +87,38 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( ) ) -:: validate alias -for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( - set alias_name=%%G - set alias_value=%%H +:: create with multiple parameters +if [%action%] == [create] ( + if not ["%args%"] == [""] ( + for /f "tokens=1,* usebackq" %%G in (`echo %args%`) do ( + set alias_name=%%G + set alias_value=%%H + ) + ) +) else ( + :: validate alias + echo %_x% + set x=!_x:%=^^%! + echo !_x! + for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( + set alias_name=%%G + set alias_value=%%H + ) + + :: leading quotes added while validating + set alias_name=!alias_name:~1! + + :: trailing quotes added while validating + set alias_value=!alias_value:~1,-1! ) -:: leading quotes added while validating -set alias_name=%alias_name:~1% - -:: trailing quotes added while validating -set alias_value=%alias_value:~0,-1% - ::remove spaces set _temp=%alias_name: =% if not ["%_temp%"] == ["%alias_name%"] ( - echo Your alias name can not contain a space - endlocal - exit /b + echo Your alias name can not contain a space + endlocal + exit /b ) :: replace already defined alias @@ -111,21 +148,26 @@ exit /b :p_help echo.Usage: echo. -echo. alias [options] [alias=full command] +echo. alias [options] [alias=alias command] or [[create [alias] [alias command]]] echo. echo.Options: echo. +echo. Note: Options MUST precede the alias definition. +echo. echo. /d [alias] Delete an [alias]. echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. echo. Default: %cmder_root%\config\user_aliases.cmd echo. /reload Reload the aliases file. Can be used with /f argument. echo. Default: %cmder_root%\config\user_aliases.cmd echo. -echo. If alias is called with no parameters, it will display the list of existing aliases. +echo. If alias is called with no parameters, it will display the list of existing aliases. echo. -echo. In the command, you can use the following notations: -echo. $* allows the alias to assume all the parameters of the supplied command. -echo. $1-$9 Allows you to seperate parameter by number, much like %%1 in batch. -echo. $T is the command seperator, allowing you to string several commands together into one alias. -echo. For more information, read DOSKEY/? +echo. In the alias command, you can use the following notations: +echo. +echo. ^^^^^^^^%% - '%%' in env vars must be escaped if preserving the variable in the alias is desired. +echo. $* - allows the alias to assume all the parameters of the supplied command. +echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in batch. +echo. $T - Command seperator, allowing you to string several commands together into one alias. +echo. +echo. For more information, read DOSKEY /? exit /b From 67b374ad378bee1b9157b9a0b20c8e667ec6c6da Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 17:09:05 -0400 Subject: [PATCH 124/371] revert alias.cmd changes --- vendor/bin/alias.cmd | 46 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 8e10d1d..1a1739d 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -48,9 +48,6 @@ goto parseargument set _x=%* ) ) - -echo _x=%_x% - rem #endregion parseargument if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( @@ -66,41 +63,18 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( ) ) -:: create with multiple parameters -if [%1] == [create] ( - if not [%2] == [] ( - if not [%3] == [] ( - set _x=%1=%2 - :: if command create was submitted - set alias_name=%~2 - shift - shift - echo %* - set alias_value=%* - - for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( - set alias_name=%%H - set alias_value=%%I - ) - ) - ) -) else ( - :: validate alias - echo %_x% - set x=!_x:%=^^%! - echo !_x! - for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( - set alias_name=%%G - set alias_value=%%H - ) - - :: leading quotes added while validating - set alias_name=!alias_name:~1! - - :: trailing quotes added while validating - set alias_value=!alias_value:~1,-1! +:: validate alias +for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( + set alias_name=%%G + set alias_value=%%H ) +:: leading quotes added while validating +set alias_name=%alias_name:~1% + +:: trailing quotes added while validating +set alias_value=%alias_value:~0,-1% + ::remove spaces set _temp=%alias_name: =% From cf134604bb465673de068bea6a14a9a318952905 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 17:31:46 -0400 Subject: [PATCH 125/371] fixes --- vendor/bin/alias.cmd | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 5000dc7..9d58ecc 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -24,7 +24,6 @@ set args= if /i "%currentarg%" equ "/f" ( set ALIASES=%~2 - set ALT_ALIASES=%~2 shift goto :do_shift ) else if /i "%currentarg%" == "/reload" ( @@ -52,13 +51,11 @@ set args= goto :p_help ) else if "%currentarg%" == "create" ( set action=create - if [%ALT_ALIASES%] neq [] ( - echo 1 + if ["%ALIASES%"] neq ["%CMDER_ROOT%\config\user_aliases.cmd"] ( for /f "tokens=1,2,3,* usebackq" %%G in (`echo %*`) do ( set args=%%J ) ) else ( - echo 2 for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( set args=%%H %%I ) @@ -85,29 +82,11 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( ) :: create with multiple parameters -<<<<<<< HEAD if [%action%] == [create] ( if not ["%args%"] == [""] ( for /f "tokens=1,* usebackq" %%G in (`echo %args%`) do ( set alias_name=%%G set alias_value=%%H -======= -if [%1] == [create] ( - if not [%2] == [] ( - if not [%3] == [] ( - set _x=%1=%2 - :: if command create was submitted - set alias_name=%~2 - shift - shift - echo %* - set alias_value=%* - - for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( - set alias_name=%%H - set alias_value=%%I - ) ->>>>>>> ac2082d56d59b3731824e11227eae396278b9f37 ) ) ) else ( From f20eca01ac386dd0d930376ece307f3b87482de2 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 17:34:00 -0400 Subject: [PATCH 126/371] fixes --- vendor/bin/alias.cmd.orig | 183 -------------------------------------- 1 file changed, 183 deletions(-) delete mode 100644 vendor/bin/alias.cmd.orig diff --git a/vendor/bin/alias.cmd.orig b/vendor/bin/alias.cmd.orig deleted file mode 100644 index e915e6b..0000000 --- a/vendor/bin/alias.cmd.orig +++ /dev/null @@ -1,183 +0,0 @@ -@echo off - - -if "%ALIASES%" == "" ( - set ALIASES="%CMDER_ROOT%\config\user_aliases.cmd" -) - -setlocal enabledelayedexpansion - -if "%~1" == "" echo Use /? for help & echo. & goto :p_show - -:: check command usage - -rem #region parseargument -goto parseargument - -set args= - -:do_shift - shift - -:parseargument - set currentarg=%~1 - - if /i "%currentarg%" equ "/f" ( - set ALIASES=%~2 - shift - goto :do_shift - ) else if /i "%currentarg%" == "/reload" ( - goto :p_reload - ) else if "%currentarg%" equ "/H" ( - goto :p_help - ) else if "%currentarg%" equ "/h" ( - goto :p_help - ) else if "%currentarg%" equ "/?" ( - goto :p_help - ) else if /i "%currentarg%" equ "/d" ( - if "%~2" neq "" ( - if "%~3" equ "" ( - :: /d flag for delete existing alias - call :p_del %~2 - shift - goto :eof - ) - ) - ) else if "%currentarg%" neq "" ( - if "%~2" equ "" ( - :: Show the specified alias - doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b - echo insufficient parameters. - goto :p_help - ) else if "%currentarg%" == "create" ( - set action=create - if ["%ALIASES%"] neq ["%CMDER_ROOT%\config\user_aliases.cmd"] ( - for /f "tokens=1,2,3,* usebackq" %%G in (`echo %*`) do ( - set args=%%J - ) - ) else ( - for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( - set args=%%H %%I - ) - ) - ) else ( - :: handle quotes within command definition, e.g. quoted long file names - set _x=%* - ) - ) -<<<<<<< HEAD - -======= ->>>>>>> 67b374ad378bee1b9157b9a0b20c8e667ec6c6da -rem #endregion parseargument - -if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( - set _x=!_x:/f "%ALIASES%" =! - - if not exist "%ALIASES%" ( - echo ;= @echo off>"%ALIASES%" - echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%" - echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%" - echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%" - echo ;= goto:eof>>"%ALIASES%" - echo ;= Add aliases below here>>"%ALIASES%" - ) -) - -<<<<<<< HEAD -:: create with multiple parameters -if [%action%] == [create] ( - if not ["%args%"] == [""] ( - for /f "tokens=1,* usebackq" %%G in (`echo %args%`) do ( - set alias_name=%%G - set alias_value=%%H - ) - ) -) else ( - :: validate alias - echo %_x% - set x=!_x:%=^^%! - echo !_x! - for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( - set alias_name=%%G - set alias_value=%%H - ) - - :: leading quotes added while validating - set alias_name=!alias_name:~1! - - :: trailing quotes added while validating - set alias_value=!alias_value:~1,-1! -======= -:: validate alias -for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( - set alias_name=%%G - set alias_value=%%H ->>>>>>> 67b374ad378bee1b9157b9a0b20c8e667ec6c6da -) - -:: leading quotes added while validating -set alias_name=%alias_name:~1% - -:: trailing quotes added while validating -set alias_value=%alias_value:~0,-1% - -::remove spaces -set _temp=%alias_name: =% - -if not ["%_temp%"] == ["%alias_name%"] ( - echo Your alias name can not contain a space - endlocal - exit /b -) - -:: replace already defined alias -%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" -echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" -doskey /macrofile="%ALIASES%" -endlocal -exit /b - -:p_del -set del_alias=%~1 -%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" -type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" -doskey %del_alias%= -doskey /macrofile="%ALIASES%" -goto:eof - -:p_reload -doskey /macrofile="%ALIASES%" -echo Aliases reloaded -exit /b - -:p_show -doskey /macros|%WINDIR%\System32\findstr /v /r "^;=" | sort -exit /b - -:p_help -echo.Usage: -echo. -echo. alias [options] [alias=alias command] or [[create [alias] [alias command]]] -echo. -echo.Options: -echo. -echo. Note: Options MUST precede the alias definition. -echo. -echo. /d [alias] Delete an [alias]. -echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. -echo. Default: %cmder_root%\config\user_aliases.cmd -echo. /reload Reload the aliases file. Can be used with /f argument. -echo. Default: %cmder_root%\config\user_aliases.cmd -echo. -echo. If alias is called with no parameters, it will display the list of existing aliases. -echo. -echo. In the alias command, you can use the following notations: -echo. -echo. ^^^^^^^^%% - '%%' in env vars must be escaped if preserving the variable in the alias is desired. -echo. $* - allows the alias to assume all the parameters of the supplied command. -echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in batch. -echo. $T - Command seperator, allowing you to string several commands together into one alias. -echo. -echo. For more information, read DOSKEY /? -exit /b From 528bbea7f5f54fe7a152e50382d7ba97eac66ed3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 22:10:21 -0400 Subject: [PATCH 127/371] fixes --- vendor/bin/alias.cmd | 51 ++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 149996a..502c11a 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -14,8 +14,6 @@ if "%~1" == "" echo Use /? for help & echo. & goto :p_show rem #region parseargument goto parseargument -set args= - :do_shift shift @@ -24,6 +22,7 @@ set args= if /i "%currentarg%" equ "/f" ( set ALIASES=%~2 + set _f=%~2 shift goto :do_shift ) else if /i "%currentarg%" == "/reload" ( @@ -50,19 +49,27 @@ set args= echo insufficient parameters. goto :p_help ) else if "%currentarg%" == "create" ( + set _x=%* + + set _x=!_x:^^=^^^^! set action=create - if ["%ALIASES%"] neq ["%CMDER_ROOT%\config\user_aliases.cmd"] ( - for /f "tokens=1,2,3,* usebackq" %%G in (`echo %*`) do ( - set args=%%J + if ["%_f%"] neq [""] ( + for /f "tokens=1,2,3,* usebackq" %%G in (`echo !_x!`) do ( + set _x=%%J ) ) else ( - for /f "tokens=1,2,* usebackq" %%G in (`echo %*`) do ( - set args=%%H %%I + for /f "tokens=1,2,* usebackq" %%G in (`echo !_x!`) do ( + set _x=%%H %%I ) ) ) else ( - :: handle quotes within command definition, e.g. quoted long file names set _x=%* + if ["%_f%"] neq [""] ( + set _x=!_x:^^=^^^^! + for /f "tokens=1,2,* usebackq" %%G in (`echo !_x!`) do ( + set _x=%%I + ) + ) ) ) @@ -81,20 +88,16 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( ) ) -<<<<<<< HEAD :: create with multiple parameters if [%action%] == [create] ( - if not ["%args%"] == [""] ( - for /f "tokens=1,* usebackq" %%G in (`echo %args%`) do ( - set alias_name=%%G - set alias_value=%%H - ) + for /f "tokens=1,* usebackq" %%G in (`echo !_x!`) do ( + set alias_name=%%G + set alias_value=%%H ) ) else ( :: validate alias - echo %_x% - set x=!_x:%=^^%! - echo !_x! + rem set _x=!_x:%=^^%! + for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( set alias_name=%%G set alias_value=%%H @@ -104,21 +107,9 @@ if [%action%] == [create] ( set alias_name=!alias_name:~1! :: trailing quotes added while validating - set alias_value=!alias_value:~1,-1! -======= -:: validate alias -for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do ( - set alias_name=%%G - set alias_value=%%H ->>>>>>> 67b374ad378bee1b9157b9a0b20c8e667ec6c6da + set alias_value=!alias_value:~0,-1! ) -:: leading quotes added while validating -set alias_name=%alias_name:~1% - -:: trailing quotes added while validating -set alias_value=%alias_value:~0,-1% - ::remove spaces set _temp=%alias_name: =% From ab3f0b76fb5506bff818cee0184b0dc09344475f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 1 Apr 2019 22:17:53 -0400 Subject: [PATCH 128/371] fixes --- vendor/bin/alias.cmd | 2 -- 1 file changed, 2 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 502c11a..999e5a0 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -96,8 +96,6 @@ if [%action%] == [create] ( ) ) else ( :: validate alias - rem set _x=!_x:%=^^%! - for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( set alias_name=%%G set alias_value=%%H From 52eea5fe9ff5264581bf825d718fa0d3b7a3147f Mon Sep 17 00:00:00 2001 From: Joshua Webb Date: Fri, 19 Apr 2019 16:16:45 +1000 Subject: [PATCH 129/371] Close file handles in clink.lua --- vendor/clink.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index d5f6876..d39a5ac 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -189,12 +189,15 @@ end -- @return {false|mercurial branch name} --- local function get_hg_branch() - for line in io.popen("hg branch 2>nul"):lines() do + local file = io.popen("hg branch 2>nul") + for line in file:lines() do local m = line:match("(.+)$") if m then + file:close() return m end end + file:close() return false end @@ -204,12 +207,15 @@ end -- @return {false|svn branch name} --- local function get_svn_branch(svn_dir) - for line in io.popen("svn info 2>nul"):lines() do + local file = io.popen("svn info 2>nul") + for line in file:lines() do local m = line:match("^Relative URL:") if m then + file:close() return line:sub(line:find("/")+1,line:len()) end end + file:close() return false end From 9b9bb13f6a694e366c076b94f7726b8a18b3e2b1 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 May 2019 17:06:44 -0400 Subject: [PATCH 130/371] fix commnd line help --- vendor/bin/alias.cmd | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 999e5a0..e5269f5 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -144,26 +144,36 @@ exit /b :p_help echo.Usage: echo. -echo. alias [options] [alias=alias command] or [[create [alias] [alias command]]] +echo. alias [options] [alias=alias command] +echo. +echo OR +echo. +echo. alias create [alias] [alias command] echo. echo.Options: echo. -echo. Note: Options MUST precede the alias definition. +echo. Note: Options MUST precede the alias definition. echo. -echo. /d [alias] Delete an [alias]. -echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. -echo. Default: %cmder_root%\config\user_aliases.cmd -echo. /reload Reload the aliases file. Can be used with /f argument. -echo. Default: %cmder_root%\config\user_aliases.cmd +echo. /d [alias] Delete an [alias]. +echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. +echo. Default: %cmder_root%\config\user_aliases.cmd +echo. /reload Reload the aliases file. Can be used with /f argument. +echo. Default: %cmder_root%\config\user_aliases.cmd echo. -echo. If alias is called with no parameters, it will display the list of existing aliases. +echo. If alias is called with no parameters, it will display the list of existing +echo. aliases. echo. echo. In the alias command, you can use the following notations: echo. -echo. ^^^^^^^^%% - '%%' in env vars must be escaped if preserving the variable in the alias is desired. -echo. $* - allows the alias to assume all the parameters of the supplied command. -echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in batch. -echo. $T - Command seperator, allowing you to string several commands together into one alias. +echo. ^^^^^^^^%% - %% signs in env vars must be escaped if preserving the variable +echo. in he alias is desired. Variables in aliases surrounded by double +echo. quotes only require '^^%%' vs '^^^^^^^^%%' +echo. $* - allows the alias to assume all the parameters of the supplied +echo. command. +echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in +echo. batch. +echo. $T - Command seperator, allowing you to string several commands +echo. together into one alias. echo. echo. For more information, read DOSKEY /? exit /b From 5f9f3560c8cb6798230d06ca2c517ebf4b481020 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 May 2019 17:11:31 -0400 Subject: [PATCH 131/371] fix commnd line help --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34ae8ed..bde41af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,13 @@ * Turn this on in existing Cmder using `clink set history_io 1` * Allow clink disable by setting CMDER_CLINK=0 before starting task +### Adds + +* Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072) + * New alias create [alias] [alias command] syntax + * Based on [#1750](https://github.com/cmderdev/cmder/pull/1750) + * Syntax: `alias create [alias] [alias command]` + ## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) ### Fixes From 5e5e0ece7364f739db5c06af2960f66a8015d1df Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 May 2019 17:25:47 -0400 Subject: [PATCH 132/371] CHANGELog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34ae8ed..6b0f875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ * Provide default settings for Clink that updates the history file in real time * Turn this on in existing Cmder using `clink set history_io 1` * Allow clink disable by setting CMDER_CLINK=0 before starting task +* Pull Request: [#2068](https://github.com/cmderdev/cmder/pull/2068) + * Print Index in History Command Output. + * Sets default `history_expand_mode = 3` in initial Clink Settings. ## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) From 893207453dd388915110150bdecea8365da392b3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 May 2019 17:27:25 -0400 Subject: [PATCH 133/371] CHANGELog --- vendor/init.bat | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 20676f6..5cc29ab 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -51,9 +51,7 @@ call "%cmder_root%\vendor\lib\lib_profile" ) else if /i "%1"=="/v" ( set verbose_output=1 ) else if /i "%1"=="/d" ( - if not defined VSCODE_CWD ( - set debug_output=1 - ) + set debug_output=1 ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" From 5def1c584ae76089fef514f60e6ddfb90b447d78 Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 12 May 2019 15:18:15 +0200 Subject: [PATCH 134/371] Add FWPARS cmdline argument. This argument forwards parameters to ConEmu app. e.g. Cmder.exe /FWPARS "-min -tsa" In this case Cmder will start minimized on TaskBar --- README.md | 1 + launcher/src/CmderLauncher.cpp | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d624972..4b9940f 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can | `/SINGLE` | Start Cmder in single mode. | | `/START [start_path]` | Folder path to start in. | | `/TASK [task_name]` | Task to start after launch. | +| `/FWPARS [ConEmu params]` | Forwads parameters to ConEmu | ## Context Menu Integration diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index e399a47..2490bb3 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -71,7 +71,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true) +void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring pars2fw = L"") { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -98,6 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr std::wstring cmderStart = path; std::wstring cmderTask = taskName; + std::wstring cmderPars2CEmu = pars2fw; std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); userConfigDirPath[cfgRoot.length()] = 0; @@ -391,6 +392,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); } + if (!streqi(cmderPars2CEmu.c_str(), L"")) + { + swprintf_s(args, L"%s %s", args, cmderPars2CEmu.c_str()); + } + SetEnvironmentVariable(L"CMDER_ROOT", exeDir); if (wcscmp(userConfigDirPath, configDirPath) != 0) { @@ -527,6 +533,7 @@ struct cmderOptions std::wstring cmderStart = L""; std::wstring cmderTask = L""; std::wstring cmderRegScope = L"USER"; + std::wstring cmderPars2CEmu = L""; bool cmderSingle = false; bool cmderUserCfg = true; bool registerApp = false; @@ -620,6 +627,11 @@ cmderOptions GetOption() } } } + else if (_wcsicmp(L"/fwpars", szArgList[i]) == 0) + { + cmderOptions.cmderPars2CEmu = szArgList[i + 1]; + i++; + } else if (cmderOptions.cmderStart == L"") { int len = wcslen(szArgList[i]); @@ -635,13 +647,13 @@ cmderOptions GetOption() } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } @@ -683,7 +695,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg); + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderPars2CEmu); } return 0; From efc978f6f821291f4ccb634f9b79d47147b74450 Mon Sep 17 00:00:00 2001 From: Wayne Arthurton Date: Thu, 16 May 2019 15:13:07 -0400 Subject: [PATCH 135/371] Update README.md Added /t switch for timed init mode. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d624972..c2f97a2 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ | `/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 | +| `/t` | Enables Cmder Timed Init Mode. This displays the time taken run init scripts | 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 | From 543c7ca6e97ce6e52fb1dccb87548f751b97e8dc Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 19 May 2019 22:54:47 +0200 Subject: [PATCH 136/371] Replace /FWPARS argument with /X as "daxgames" request. --- CHANGELOG.md | 6 ++++++ README.md | 2 +- launcher/src/CmderLauncher.cpp | 21 +++++++++++---------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f6ef29..133b1e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +* Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094) +* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096) + * New argument created to ConEmu forwarding arguments. + * Syntax: `/x [ConEmu extras arguments]` + * e.g.: `Cmder.exe /x "-min -tsa"` + ### Fixes * Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002) diff --git a/README.md b/README.md index 4b9940f..97378b4 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can | `/SINGLE` | Start Cmder in single mode. | | `/START [start_path]` | Folder path to start in. | | `/TASK [task_name]` | Task to start after launch. | -| `/FWPARS [ConEmu params]` | Forwads parameters to ConEmu | +| `/X [ConEmu extras pars]` | Forwads parameters to ConEmu | ## Context Menu Integration diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 2490bb3..de10d04 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -71,7 +71,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring pars2fw = L"") +void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"") { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -98,7 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr std::wstring cmderStart = path; std::wstring cmderTask = taskName; - std::wstring cmderPars2CEmu = pars2fw; + std::wstring cmderConEmuArgs = conemu_args; std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); userConfigDirPath[cfgRoot.length()] = 0; @@ -392,9 +392,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); } - if (!streqi(cmderPars2CEmu.c_str(), L"")) + if (!streqi(cmderConEmuArgs.c_str(), L"")) { - swprintf_s(args, L"%s %s", args, cmderPars2CEmu.c_str()); + swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str()); } SetEnvironmentVariable(L"CMDER_ROOT", exeDir); @@ -533,7 +533,7 @@ struct cmderOptions std::wstring cmderStart = L""; std::wstring cmderTask = L""; std::wstring cmderRegScope = L"USER"; - std::wstring cmderPars2CEmu = L""; + std::wstring cmderConEmuArgs = L""; bool cmderSingle = false; bool cmderUserCfg = true; bool registerApp = false; @@ -627,9 +627,10 @@ cmderOptions GetOption() } } } - else if (_wcsicmp(L"/fwpars", szArgList[i]) == 0) + /* Used for passing arguments to conemu prog */ + else if (_wcsicmp(L"/x", szArgList[i]) == 0) { - cmderOptions.cmderPars2CEmu = szArgList[i + 1]; + cmderOptions.cmderConEmuArgs = szArgList[i + 1]; i++; } else if (cmderOptions.cmderStart == L"") @@ -647,13 +648,13 @@ cmderOptions GetOption() } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } @@ -695,7 +696,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderPars2CEmu); + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs); } return 0; From a97ce1f95050a255db518e24c89810e3563719aa Mon Sep 17 00:00:00 2001 From: Martin Kemp Date: Fri, 24 May 2019 13:47:01 +0100 Subject: [PATCH 137/371] Create stale.yml --- .github/stale.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..426c00a --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,18 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - 📌 Pinned +# Label to use when marking an issue as stale +staleLabel: 👀 Awaiting Response +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed in a week if no further activity occurs. + Thank you for your contribution. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: > + This issue has been automatically closed due to it not having any + activity since it was marked as stale. Thank you for your contribution. From 73c21d1a59a62c848fbcea3a46cb965d5e5e4f18 Mon Sep 17 00:00:00 2001 From: Martin Kemp Date: Fri, 24 May 2019 13:54:09 +0100 Subject: [PATCH 138/371] Wrap labels with quotes --- .github/stale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/stale.yml b/.github/stale.yml index 426c00a..c3b0200 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -4,9 +4,9 @@ daysUntilStale: 30 daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - - 📌 Pinned + - "📌 Pinned" # Label to use when marking an issue as stale -staleLabel: 👀 Awaiting Response +staleLabel: "👀 Awaiting Response" # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had From ea531cdd444f9b97a90ffad713207e8f38fc3829 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Mon, 3 Jun 2019 06:23:00 -0400 Subject: [PATCH 139/371] Fix post-install.bat not running and deleting itself (#2106) * Fix post-install.bat not running * Changelog * Changelog --- CHANGELOG.md | 3 +++ vendor/init.bat | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 133b1e0..7543a5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ ### Fixes +* Pull Request: [#2106](https://github.com/cmderdev/cmder/pull/2106) + * Portable Git requires running `post-install.bat` which deletes itself when done. This was not happening. + * Resolves [#2105](https://github.com/cmderdev/cmder/issues/2105) * Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002) * Updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy diff --git a/vendor/init.bat b/vendor/init.bat index bb089d6..d0737dd 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -369,9 +369,9 @@ call "%user_aliases%" :: Basically we need to execute this post-install.bat because we are :: manually extracting the archive rather than executing the 7z sfx if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - %lib_console% verbose_output "Running Git for Windows one time Post Install...." + echo Running Git for Windows one time Post Install.... pushd "%GIT_INSTALL_ROOT%\" - "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat + "%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat popd ) From 8f59d529f4350d9167fd2cce6817d0a0bc32f784 Mon Sep 17 00:00:00 2001 From: Martin Kemp Date: Thu, 20 Jun 2019 10:12:12 +0100 Subject: [PATCH 140/371] Update stale comments --- .github/stale.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/stale.yml b/.github/stale.yml index c3b0200..30fb6b0 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -10,9 +10,10 @@ staleLabel: "👀 Awaiting Response" # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had - recent activity. It will be closed in a week if no further activity occurs. - Thank you for your contribution. + any recent activity. It will be closed in a week if no further activity occurs. + Thank you for your contribution(s). # Comment to post when closing a stale issue. Set to `false` to disable closeComment: > This issue has been automatically closed due to it not having any - activity since it was marked as stale. Thank you for your contribution. + activity since it was marked as stale. + Thank you for your contribution(s). From b61752f89e7ce1cd13786f413f3eeec70b841dd7 Mon Sep 17 00:00:00 2001 From: SupinePandora43 <36124472+SupinePandora43@users.noreply.github.com> Date: Tue, 25 Jun 2019 12:37:57 +0400 Subject: [PATCH 141/371] vscode.bat add that to settings.json `"terminal.integrated.shell.windows": "cmd.exe", "terminal.integrated.shellArgs.windows": [ "/K", "%CMDER_ROOT%/vscode.bat", ]` for using cmder inside vscode --- vscode.bat | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 vscode.bat diff --git a/vscode.bat b/vscode.bat new file mode 100644 index 0000000..77fd534 --- /dev/null +++ b/vscode.bat @@ -0,0 +1,9 @@ +@echo off +IF [%1] == [] ( + REM -- manually opened console (Ctrl + Shift + `) -- + CALL "%~dp0\vendor\init.bat" +) ELSE ( + REM -- task -- + CALL cmd %* + exit +) From 72dd8376cd6ac8444d7202f3686fc06c64d1d943 Mon Sep 17 00:00:00 2001 From: SupinePandora43 Date: Thu, 27 Jun 2019 16:00:55 +0500 Subject: [PATCH 142/371] move https://github.com/cmderdev/cmder/pull/2113#issuecomment-506044156 --- vscode.bat => vendor/bin/vscode_init.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename vscode.bat => vendor/bin/vscode_init.cmd (80%) diff --git a/vscode.bat b/vendor/bin/vscode_init.cmd similarity index 80% rename from vscode.bat rename to vendor/bin/vscode_init.cmd index 77fd534..f95dc66 100644 --- a/vscode.bat +++ b/vendor/bin/vscode_init.cmd @@ -1,7 +1,7 @@ @echo off IF [%1] == [] ( REM -- manually opened console (Ctrl + Shift + `) -- - CALL "%~dp0\vendor\init.bat" + CALL "%~dp0..\init.bat" ) ELSE ( REM -- task -- CALL cmd %* From 38fd3468fe35f9a44f710a925081eff6c8388089 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 7 Jul 2019 13:30:34 -0400 Subject: [PATCH 143/371] restore old alias.cmd without 'create' option --- vendor/bin/alias.cmd | 49 ++++++++++---------------------------------- 1 file changed, 11 insertions(+), 38 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 999e5a0..ecf8878 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -48,28 +48,9 @@ goto parseargument doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b echo insufficient parameters. goto :p_help - ) else if "%currentarg%" == "create" ( - set _x=%* - - set _x=!_x:^^=^^^^! - set action=create - if ["%_f%"] neq [""] ( - for /f "tokens=1,2,3,* usebackq" %%G in (`echo !_x!`) do ( - set _x=%%J - ) - ) else ( - for /f "tokens=1,2,* usebackq" %%G in (`echo !_x!`) do ( - set _x=%%H %%I - ) - ) ) else ( + :: handle quotes within command definition, e.g. quoted long file names set _x=%* - if ["%_f%"] neq [""] ( - set _x=!_x:^^=^^^^! - for /f "tokens=1,2,* usebackq" %%G in (`echo !_x!`) do ( - set _x=%%I - ) - ) ) ) @@ -88,26 +69,18 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" ( ) ) -:: create with multiple parameters -if [%action%] == [create] ( - for /f "tokens=1,* usebackq" %%G in (`echo !_x!`) do ( - set alias_name=%%G - set alias_value=%%H - ) -) else ( - :: validate alias - for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( - set alias_name=%%G - set alias_value=%%H - ) - - :: leading quotes added while validating - set alias_name=!alias_name:~1! - - :: trailing quotes added while validating - set alias_value=!alias_value:~0,-1! +:: validate alias +for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do ( + set alias_name=%%G + set alias_value=%%H ) +:: leading quotes added while validating +set alias_name=!alias_name:~1! + +:: trailing quotes added while validating +set alias_value=!alias_value:~0,-1! + ::remove spaces set _temp=%alias_name: =% From b58b3b45475f89e67c6b699a908b2ee88f0819e4 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 7 Jul 2019 13:52:34 -0400 Subject: [PATCH 144/371] restore old alias.cmd without 'create' option --- vendor/bin/alias.cmd | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index be9ee37..ccac5df 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -119,10 +119,6 @@ echo.Usage: echo. echo. alias [options] [alias=alias command] echo. -echo OR -echo. -echo. alias create [alias] [alias command] -echo. echo.Options: echo. echo. Note: Options MUST precede the alias definition. From f8e859f844dfbc2fb4a5cef5fd265de258af4366 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 7 Jul 2019 14:05:14 -0400 Subject: [PATCH 145/371] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7543a5a..97759c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ ### Fixes +* Pull Request: [#2122](https://github.com/cmderdev/cmder/pull/2122) + * Restore old `alias.cmd` without `create` syntax because it did not work in all situations. +* Pull Request: [#2113](https://github.com/cmderdev/cmder/pull/2113) + * Add `vendor\bin\vscode_init.cmd` for use with Visual Studio Code + * Fixes [#2118](https://github.com/cmderdev/cmder/issues/2118) + * Fixes [#1985](https://github.com/cmderdev/cmder/issues/1985) * Pull Request: [#2106](https://github.com/cmderdev/cmder/pull/2106) * Portable Git requires running `post-install.bat` which deletes itself when done. This was not happening. * Resolves [#2105](https://github.com/cmderdev/cmder/issues/2105) From 5477b7812dccca626d268181abb20ddd19d94968 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 18 Aug 2019 17:39:29 -0400 Subject: [PATCH 146/371] Re-arrange CHANGELOG.md. --- CHANGELOG.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97759c0..cec29b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,6 @@ ## [Unreleased] -* Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094) -* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096) - * New argument created to ConEmu forwarding arguments. - * Syntax: `/x [ConEmu extras arguments]` - * e.g.: `Cmder.exe /x "-min -tsa"` - ### Fixes * Pull Request: [#2122](https://github.com/cmderdev/cmder/pull/2122) @@ -35,6 +29,11 @@ ### Adds +* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096) + * Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094) + * New argument created to ConEmu forwarding arguments. + * Syntax: `/x [ConEmu extras arguments]` + * e.g.: `Cmder.exe /x "-min -tsa"` * Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072) * New alias create [alias] [alias command] syntax * Based on [#1750](https://github.com/cmderdev/cmder/pull/1750) From ecda3acfdf349cb016141066ff74ea2c275a59f9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 18 Aug 2019 17:49:56 -0400 Subject: [PATCH 147/371] Update CHANGELOG.md --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cec29b6..e081cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,6 @@ ### Fixes -* Pull Request: [#2122](https://github.com/cmderdev/cmder/pull/2122) - * Restore old `alias.cmd` without `create` syntax because it did not work in all situations. * Pull Request: [#2113](https://github.com/cmderdev/cmder/pull/2113) * Add `vendor\bin\vscode_init.cmd` for use with Visual Studio Code * Fixes [#2118](https://github.com/cmderdev/cmder/issues/2118) @@ -34,10 +32,6 @@ * New argument created to ConEmu forwarding arguments. * Syntax: `/x [ConEmu extras arguments]` * e.g.: `Cmder.exe /x "-min -tsa"` -* Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072) - * New alias create [alias] [alias command] syntax - * Based on [#1750](https://github.com/cmderdev/cmder/pull/1750) - * Syntax: `alias create [alias] [alias command]` ## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) From a85a208b2025d48d4d7317ac281a52fa16546818 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 18 Aug 2019 18:26:21 -0400 Subject: [PATCH 148/371] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e081cfa..d8ad2f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [Unreleased] +## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-18) ### Fixes From 45e56002495b8bcdfcffdb043944f36813694ef1 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 26 Sep 2019 18:07:25 -0400 Subject: [PATCH 149/371] update Changelog, clink 0.3.4, fix ps fg color --- CHANGELOG.md | 15 ++++++++++----- vendor/profile.ps1 | 1 + vendor/sources.json | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97759c0..7b98630 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,10 @@ ## [Unreleased] -* Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094) -* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096) - * New argument created to ConEmu forwarding arguments. - * Syntax: `/x [ConEmu extras arguments]` - * e.g.: `Cmder.exe /x "-min -tsa"` +* Update Clink to 0.3.4 +* Fix powershell foreground color changingf to green + +## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.11) (2019-08-18) ### Fixes @@ -35,6 +34,12 @@ ### Adds +* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096) + * Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094) + * New argument created to ConEmu forwarding arguments. + * Syntax: `/x [ConEmu extras arguments]` + * e.g.: `Cmder.exe /x "-min -tsa"` + * Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072) * New alias create [alias] [alias command] syntax * Based on [#1750](https://github.com/cmderdev/cmder/pull/1750) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index b9ac89d..aa90974 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -177,6 +177,7 @@ if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionS [ScriptBlock]$PostPrompt = {} [ScriptBlock]$CmderPrompt = { $Host.UI.RawUI.ForegroundColor = "White" + Write-Host -NoNewline "$([char]0x200B)" Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green if (get-command git -erroraction silentlycontinue) { checkGit($pwd.ProviderPath) diff --git a/vendor/sources.json b/vendor/sources.json index b8f3f8a..bd864e7 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -16,7 +16,7 @@ }, { "name": "clink-completions", - "version": "0.3.3", - "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.3.zip" + "version": "0.3.4", + "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.4.zip" } ] From 3a44bc809ddd963098ff96e60b376e6d581d7fe9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 27 Sep 2019 18:17:24 -0400 Subject: [PATCH 150/371] add ~ match to vendor/clink.lua/ --- vendor/clink.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vendor/clink.lua b/vendor/clink.lua index d39a5ac..5e47246 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -385,7 +385,24 @@ local function svn_prompt_filter() return false end +local function tilde_match (text, f, l) + if text == '~' then + clink.add_match(clink.get_env('userprofile')) + clink.matches_are_files() + return true + end + + if text:sub(1, 1) == '~' then + clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1)) + -- second match prevents adding a space so we can look for more matches + clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1) .. '+') + clink.matches_are_files() + return true + end +end + -- insert the set_prompt at the very beginning so that it runs first +clink.register_match_generator(tilde_match, 1) clink.prompt.register_filter(set_prompt_filter, 1) clink.prompt.register_filter(hg_prompt_filter, 50) clink.prompt.register_filter(git_prompt_filter, 50) From 377d97e56aaf0a3cce1ad7f999d4960f9d327716 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Oct 2019 10:07:23 -0400 Subject: [PATCH 151/371] fix path with ! in dir --- vendor/init.bat | 83 +++++++++++++++++------------------------ vendor/lib/lib_base.cmd | 31 +++++++++------ vendor/lib/lib_git.cmd | 8 ++-- vendor/lib/lib_path.cmd | 19 +++++++--- 4 files changed, 73 insertions(+), 68 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index d0737dd..7855a7a 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -165,7 +165,6 @@ if not defined TERM set TERM=cygwin :: * test if a git is in path and if yes, use that :: * last, use our vendored git :: 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 :SPECIFIED_GIT ) else if "%fast_init%" == "1" ( @@ -182,6 +181,7 @@ if defined GIT_INSTALL_ROOT ( %lib_git% validate_version VENDORED %GIT_VERSION_VENDORED% :: check if git is in path... +setlocal enabledelayedexpansion for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :: get the absolute path to the user provided git binary pushd %%~dpF @@ -219,21 +219,19 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( set test_dir= ) ) else ( - :: if the user provided git executable is not found if !errorlevel! equ -255 ( call :verbose_output No git at "!git_executable!" found. set test_dir= ) - ) ) +endlocal & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" & set "GIT_VERSION_VENDORED=%GIT_VERSION_VENDORED%" :: our last hope: our own git... :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 '!GIT_VERSION_VENDORED!' from '!GIT_INSTALL_ROOT!..." goto :CONFIGURE_GIT ) else ( goto :NO_GIT @@ -249,43 +247,42 @@ 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 - if %nix_tools% equ 1 ( - %lib_console% debug_output init.bat "Preferring Windows commands" - set "path_position=append" - ) else ( - %lib_console% debug_output init.bat "Preferring *nix commands" - set "path_position=" - ) +rem add the unix commands at the end to not shadow windows commands like more +if %nix_tools% equ 1 ( + %lib_console% debug_output init.bat "Preferring Windows commands" + set "path_position=append" +) else ( + %lib_console% debug_output init.bat "Preferring *nix commands" + set "path_position=" +) - if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" !path_position! - if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! - ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! - ) +if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position% +if exist "%GIT_INSTALL_ROOT%\mingw32" ( + %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% +) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( + %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! - ) +if %nix_tools% geq 1 ( + %lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" %path_position% +) - :: 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 LANG ( - :: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. - if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe" - if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F") - if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale - if not defined git_locale set git_locale=env /usr/bin/locale - for /F "delims=" %%F in ('!git_locale! -uU 2') do ( - set "LANG=%%F" - ) +:: 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" + +:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. +if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe" +if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F") +if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale +if not defined git_locale set git_locale=env /usr/bin/locale + +%lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" +if not defined LANG ( + for /F "delims=" %%F in ('%git_locale% -uU 2') do ( + set "LANG=%%F" ) ) -endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" %lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" %lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" goto :PATH_ENHANCE @@ -331,22 +328,12 @@ if "%CMDER_ALIASES%" == "1" ( ) REM Make sure we have a self-extracting user_aliases.cmd file - setlocal enabledelayedexpansion + REM setlocal enabledelayedexpansion if not exist "%user_aliases%" ( echo Creating initial user_aliases store in "%user_aliases%"... copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" ) else ( - type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul - if "!errorlevel!" == "1" ( - echo Creating initial user_aliases store in "%user_aliases%"... - if defined CMDER_USER_CONFIG ( - copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" - ) else ( - copy "%user_aliases%" "%user_aliases%.old_format" - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" - ) - ) + %lib_base% update_legacy_aliases ) :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' @@ -359,7 +346,7 @@ if "%CMDER_ALIASES%" == "1" ( type "%user_aliases%.old_format" >> "%user_aliases%" del "%user_aliases%.old_format" ) - endlocal + REM endlocal ) :: Add aliases to the environment diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index ac8d034..154dee3 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -65,17 +65,26 @@ exit /b echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle" - if not defined CMDER_CLINK ( - set CMDER_CLINK=1 - if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 - if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 - ) + set CMDER_CLINK=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 - - if not defined CMDER_ALIASES ( - set CMDER_ALIASES=1 - if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 - if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 - ) + set CMDER_ALIASES=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 exit /b + +:update_legacy_aliases + type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul + if "%errorlevel%" == "1" ( + echo Creating initial user_aliases store in "%user_aliases%"... + if defined CMDER_USER_CONFIG ( + copy "%user_aliases%" "%user_aliases%.old_format" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" + ) else ( + copy "%user_aliases%" "%user_aliases%.old_format" + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" + ) + ) + exit /b diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 02f156b..30fffb3 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -34,6 +34,8 @@ exit /b ::: GIT_VERSION_[GIT SCOPE] Env variable containing Git semantic version string :::------------------------------------------------------------------------------- +echo CMDER_HERE1.2 + setlocal enabledelayedexpansion :: clear the variables set GIT_VERSION_%~1= @@ -88,11 +90,8 @@ exit /b ::: [SCOPE]_BUILD Scoped Build version. :::------------------------------------------------------------------------------- + setlocal enabledelayedexpansion :: process a `x.x.x.xxxx.x` formatted string - set "%~1_MAJOR=" - set "%~1_MINOR=" - set "%~1_PATCH=" - set "%~1_BUILD=" %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" @@ -101,6 +100,7 @@ exit /b set "%~1_BUILD=%%D" ) + endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!" exit /b :validate_version diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 6e31560..08a5c76 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -38,7 +38,6 @@ exit /b ::: path Sets the path env variable if required. :::------------------------------------------------------------------------------- - setlocal enabledelayedexpansion if "%~1" neq "" ( set "add_path=%~1" ) else ( @@ -58,9 +57,15 @@ exit /b ) else ( set "PATH=%add_path%;%PATH%" ) - goto :end_enhance_path ) + set "PATH=%PATH:;;=;%" + if "%fast_init%" == "1" ( + exit /b + ) + + setlocal enabledelayedexpansion + set found=0 set "find_query=%add_path%" set "find_query=%find_query:\=\\%" @@ -125,7 +130,6 @@ exit /b :::. ::: path Sets the path env variable if required. :::------------------------------------------------------------------------------- - setlocal enabledelayedexpansion if "%~1" neq "" ( set "add_path=%~1" ) else ( @@ -147,10 +151,15 @@ exit /b if "%fast_init%" == "1" ( call :enhance_path "%add_path%" %position% - goto :end_enhance_path_recursive ) - if "%depth%" == "" set depth=0 + set "PATH=%PATH:;;=;%" + if "%fast_init%" == "1" ( + exit /b + ) + + setlocal enabledelayedexpansion + if "%depth%" == "" set depth=0 %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%" %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%" From 05836e761eb8286af8a6b663b5d354945c03062d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Oct 2019 10:11:38 -0400 Subject: [PATCH 152/371] merge --- CHANGELOG.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b35a6e..87c3cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,10 @@ ## [Unreleased] -<<<<<<< HEAD -* Update Clink to 0.3.4 -* Fix powershell foreground color changingf to green -======= * Update Clink Completions to 0.3.4 * Fix powershell foreground color changing to green ->>>>>>> 4575ac3209f7d513504bcaf80b41ef1106c9406a -## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.11) (2019-08-18) +## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-18) ### Fixes From 57b328b20946bd424d7f1500775c2eb32137da9e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Oct 2019 10:15:26 -0400 Subject: [PATCH 153/371] cleanup --- vendor/init.bat | 2 -- 1 file changed, 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 03dd18e..ac32ef7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -328,7 +328,6 @@ if "%CMDER_ALIASES%" == "1" ( ) REM Make sure we have a self-extracting user_aliases.cmd file - REM setlocal enabledelayedexpansion if not exist "%user_aliases%" ( echo Creating initial user_aliases store in "%user_aliases%"... copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" @@ -346,7 +345,6 @@ if "%CMDER_ALIASES%" == "1" ( type "%user_aliases%.old_format" >> "%user_aliases%" del "%user_aliases%.old_format" ) - REM endlocal ) :: Add aliases to the environment From db42252ef253aec8a9103ffcc532c69508a5c8ce Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Oct 2019 10:18:04 -0400 Subject: [PATCH 154/371] cleanup --- vendor/lib/lib_git.cmd | 2 -- 1 file changed, 2 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 30fffb3..bfbcdb2 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -34,8 +34,6 @@ exit /b ::: GIT_VERSION_[GIT SCOPE] Env variable containing Git semantic version string :::------------------------------------------------------------------------------- -echo CMDER_HERE1.2 - setlocal enabledelayedexpansion :: clear the variables set GIT_VERSION_%~1= From 468dba474e18a3a37bc484f57f2952be4ee210e8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Oct 2019 15:47:25 -0400 Subject: [PATCH 155/371] fixes --- vendor/init.bat | 103 ++++++++++++++++++++++------------------ vendor/lib/lib_git.cmd | 55 +++++++++++++-------- vendor/lib/lib_path.cmd | 63 +++++++++++++++--------- 3 files changed, 134 insertions(+), 87 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index ac32ef7..fd7ef4e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -181,54 +181,14 @@ if defined GIT_INSTALL_ROOT ( %lib_git% validate_version VENDORED %GIT_VERSION_VENDORED% :: check if git is in path... -setlocal enabledelayedexpansion for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :: get the absolute path to the user provided git binary - pushd %%~dpF - :: check if there's shim - and if yes follow the path - if exist git.shim ( - for /F "tokens=2 delims== " %%I in (git.shim) do ( - pushd %%~dpI - set "test_dir=!CD!" - popd - ) - ) else ( - set "test_dir=!CD!" - ) - popd - - :: get the version information for the user provided git binary - %lib_git% read_version USER "!test_dir!" - %lib_git% validate_version USER !GIT_VERSION_USER! - - if !errorlevel! geq 0 ( - :: compare the user git version against the vendored version - %lib_git% compare_versions USER VENDORED - - :: use the user provided git if its version is greater than, or equal to the vendored git - if !errorlevel! geq 0 if exist "!test_dir:~0,-4!\cmd\git.exe" ( - set "GIT_INSTALL_ROOT=!test_dir:~0,-4!" - set test_dir= - goto :FOUND_GIT - ) else if !errorlevel! geq 0 ( - set "GIT_INSTALL_ROOT=!test_dir!" - set test_dir= - goto :FOUND_GIT - ) else ( - call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... - set test_dir= - ) - ) else ( - :: if the user provided git executable is not found - if !errorlevel! equ -255 ( - call :verbose_output No git at "!git_executable!" found. - set test_dir= - ) - ) + call :is_git_shim "%%~dpF" + call :get_user_git_version + call :compare_git_versions ) -endlocal & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" & set "GIT_VERSION_VENDORED=%GIT_VERSION_VENDORED%" -:: our last hope: our own git... + :VENDORED_GIT if exist "%CMDER_ROOT%\vendor\git-for-windows" ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" @@ -242,7 +202,7 @@ if exist "%CMDER_ROOT%\vendor\git-for-windows" ( goto :CONFIGURE_GIT :FOUND_GIT -%lib_console% debug_output "Using found Git '!GIT_VERSION_USER!' from '%GIT_INSTALL_ROOT%..." +%lib_console% debug_output "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." goto :CONFIGURE_GIT :CONFIGURE_GIT @@ -407,3 +367,56 @@ if %time_init% gtr 0 ( "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% ) exit /b + +:is_git_shim + pushd "%~1" + :: check if there's shim - and if yes follow the path + setlocal enabledelayedexpansion + if exist git.shim ( + for /F "tokens=2 delims== " %%I in (git.shim) do ( + pushd %%~dpI + set "test_dir=!CD!" + popd + ) + ) else ( + set "test_dir=!CD!" + ) + endlocal & set "test_dir=%test_dir%" + + popd + exit /b + +:compare_git_versions + if %errorlevel% geq 0 ( + :: compare the user git version against the vendored version + %lib_git% compare_versions USER VENDORED + + :: use the user provided git if its version is greater than, or equal to the vendored git + if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( + set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" + set test_dir= + goto :FOUND_GIT + ) else if %errorlevel% geq 0 ( + set "GIT_INSTALL_ROOT=%test_dir%" + set test_dir= + goto :FOUND_GIT + ) else ( + call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... + set test_dir= + ) + ) else ( + :: if the user provided git executable is not found + if %errorlevel% equ -255 ( + call :verbose_output No git at "%git_executable%" found. + set test_dir= + ) + ) + exit /b + +:get_user_git_version + + :: get the version information for the user provided git binary + %lib_git% read_version USER "%test_dir%" + %lib_git% validate_version USER %GIT_VERSION_USER% + exit /b + diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index bfbcdb2..3f4cdef 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -34,7 +34,6 @@ exit /b ::: GIT_VERSION_[GIT SCOPE] Env variable containing Git semantic version string :::------------------------------------------------------------------------------- - setlocal enabledelayedexpansion :: clear the variables set GIT_VERSION_%~1= @@ -49,18 +48,20 @@ 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 ( + + "%git_executable%" --version > "%temp%\git_version.txt" + setlocal enabledelayedexpansion + for /F "tokens=1,2,3 usebackq" %%A in (`type "%temp%\git_version.txt" 2^>nul`) do ( if /i "%%A %%B" == "git version" ( 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! + echo "'git --version' returned an inproper version string!" pause exit /b ) ) + endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%" & %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%GIT_VERSION%" - endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%" exit /b :parse_version @@ -88,9 +89,10 @@ exit /b ::: [SCOPE]_BUILD Scoped Build version. :::------------------------------------------------------------------------------- - setlocal enabledelayedexpansion :: process a `x.x.x.xxxx.x` formatted string %lib_console% debug_output :parse_version "ARGV[1]=%~1, ARGV[2]=%~2" + + setlocal enabledelayedexpansion for /F "tokens=1-3* delims=.,-" %%A in ("%2") do ( set "%~1_MAJOR=%%A" set "%~1_MINOR=%%B" @@ -98,9 +100,17 @@ exit /b set "%~1_BUILD=%%D" ) - endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!" + REM endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!" + if "%~1" == "VENDORED" ( + endlocal & set "%~1_MAJOR=%VENDORED_MAJOR%" & set "%~1_MINOR=%VENDORED_MINOR%" & set "%~1_PATCH=%VENDORED_PATCH%" & set "%~1_BUILD=%VENDORED_BUILD%" + ) else ( + endlocal & set "%~1_MAJOR=%USER_MAJOR%" & set "%~1_MINOR=%USER_MINOR%" & set "%~1_PATCH=%USER_PATCH%" & set "%~1_BUILD=%USER_BUILD%" + ) + exit /b +:endlocal_set_git_version + :validate_version :::=============================================================================== :::validate_version - Validate semantic version string 'x.x.x.x'. @@ -121,10 +131,16 @@ 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. - %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" + REM %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" + if "%~1" == "VENDORED" ( + %lib_console% debug_output :validate_version "Found Git Version for %~1: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%" + ) else ( + %lib_console% debug_output :validate_version "Found Git Version for %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%" + ) exit /b :compare_versions @@ -149,20 +165,21 @@ exit /b :: 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 %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD% + %lib_console% debug_output %~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD% - if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1) - if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1) + setlocal enabledelayedexpansion + if !%~1_MAJOR! GTR !%~2_MAJOR! (endlocal & exit /b 1) + if !%~1_MAJOR! LSS !%~2_MAJOR! (endlocal & exit /b -1) - if !%~1_MINOR! GTR !%~2_MINOR! (exit /b 1) - if !%~1_MINOR! LSS !%~2_MINOR! (exit /b -1) + if !%~1_MINOR! GTR !%~2_MINOR! (endlocal & exit /b 1) + if !%~1_MINOR! LSS !%~2_MINOR! (endlocal & exit /b -1) - if !%~1_PATCH! GTR !%~2_PATCH! (exit /b 1) - if !%~1_PATCH! LSS !%~2_PATCH! (exit /b -1) + if !%~1_PATCH! GTR !%~2_PATCH! (endlocal & exit /b 1) + if !%~1_PATCH! LSS !%~2_PATCH! (endlocal & exit /b -1) - if !%~1_BUILD! GTR !%~2_BUILD! (exit /b 1) - if !%~1_BUILD! LSS !%~2_BUILD! (exit /b -1) + if !%~1_BUILD! GTR !%~2_BUILD! (endlocal & exit /b 1) + if !%~1_BUILD! LSS !%~2_BUILD! (endlocal & exit /b -1) :: looks like we have the same versions. - exit /b 0 + endlocal & exit /b 0 diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 08a5c76..8f7188c 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -64,7 +64,7 @@ exit /b exit /b ) - setlocal enabledelayedexpansion + rem setlocal enabledelayedexpansion set found=0 set "find_query=%add_path%" @@ -74,20 +74,22 @@ exit /b if "%CMDER_CONFIGURED%" == "1" ( %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" echo "%path%"|%WINDIR%\System32\findstr >nul /I /R ";%find_query%\"$" - if "!ERRORLEVEL!" == "0" set found=1 + REM if "!ERRORLEVEL!" == "0" set found=1 + call :set_found ) - %lib_console% debug_output :enhance_path "Env Var 1 - found=!found!" + %lib_console% debug_output :enhance_path "Env Var 1 - found=%found%" - if "!found!" == "0" ( + if "%found%" == "0" ( if "%CMDER_CONFIGURED%" == "1" ( echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;" - if "!ERRORLEVEL!" == "0" set found=1 + REM if "!ERRORLEVEL!" == "0" set found=1 + call :set_found ) - %lib_console% debug_output :enhance_path "Env Var 2 - found=!found!" + %lib_console% debug_output :enhance_path "Env Var 2 - found=%found%" ) if "%found%" == "0" ( - %lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=!path!" + %lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=%path%" if /i "%position%" == "append" ( %lib_console% debug_output :enhance_path "Appending '%add_path%'" set "PATH=%PATH%;%add_path%" @@ -96,11 +98,16 @@ exit /b set "PATH=%add_path%;%PATH%" ) - %lib_console% debug_output :enhance_path "AFTER Env Var - PATH=!path!" + %lib_console% debug_output :enhance_path "AFTER Env Var - PATH=%path%" ) - :end_enhance_path - endlocal & set "PATH=%PATH:;;=;%" + rem :end_enhance_path + rem endlocal & set "PATH=%PATH:;;=;%" + set "PATH=%PATH:;;=;%" + exit /b + +:set_found + if "!ERRORLEVEL!" == "0" set found=1 exit /b :enhance_path_recursive @@ -158,26 +165,36 @@ exit /b exit /b ) - setlocal enabledelayedexpansion - if "%depth%" == "" set depth=0 + rem setlocal enabledelayedexpansion + if "%depth%" == "" set depth=0 %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%" %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%" %lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%" - if %max_depth% gtr !depth! ( + if %max_depth% gtr %depth% ( %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'" call :enhance_path "%add_path%" %position% - set /a "depth=!depth!+1" - - for /d %%i in ("%add_path%\*") do ( - %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=!depth!" - %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'" - call :enhance_path_recursive "%%~fi" %max_depth% %position% - %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=!depth!" - ) + REM set /a "depth=!depth!+1" + call :set_depth + call :loop_depth ) - :end_enhance_path_recursive - endlocal & set "PATH=%PATH%" + rem :end_enhance_path_recursive + rem endlocal & set "PATH=%PATH%" + set "PATH=%PATH%" exit /b + +: set_depth + set /a "depth=%depth%+1" + exit /b + +:loop_depth + for /d %%i in ("%add_path%\*") do ( + %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=%depth%" + %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'" + call :enhance_path_recursive "%%~fi" %max_depth% %position% + %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=%depth%" + ) + exit /b + From 34468ef2fd806728f725c70c53a684b6d6badf6c Mon Sep 17 00:00:00 2001 From: Dax Games Date: Thu, 22 Aug 2019 06:20:19 -0400 Subject: [PATCH 156/371] cleanup --- .kitchen/logs/kitchen.log | 26 ++++++++++++++++++++++++++ Version 1.3.11.843 | 0 Version 1.3.12.915 | 0 vendor/lib/lib_base.cmd | 16 ++++++++++------ 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .kitchen/logs/kitchen.log create mode 100644 Version 1.3.11.843 create mode 100644 Version 1.3.12.915 diff --git a/.kitchen/logs/kitchen.log b/.kitchen/logs/kitchen.log new file mode 100644 index 0000000..b499d0b --- /dev/null +++ b/.kitchen/logs/kitchen.log @@ -0,0 +1,26 @@ +E, [2019-04-10T13:42:14.068995 #11604] ERROR -- Kitchen: ------Exception------- +E, [2019-04-10T13:42:14.069283 #11604] ERROR -- Kitchen: Class: Kitchen::UserError +E, [2019-04-10T13:42:14.069377 #11604] ERROR -- Kitchen: Message: Kitchen YAML file C:/tools/Cmder/.kitchen.yml does not exist. +E, [2019-04-10T13:42:14.069453 #11604] ERROR -- Kitchen: ---------------------- +E, [2019-04-10T13:42:14.069523 #11604] ERROR -- Kitchen: ------Backtrace------- +E, [2019-04-10T13:42:14.069657 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/loader/yaml.rb:65:in `read' +E, [2019-04-10T13:42:14.069713 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:152:in `data' +E, [2019-04-10T13:42:14.069760 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:131:in `suites' +E, [2019-04-10T13:42:14.069803 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:182:in `filter_instances' +E, [2019-04-10T13:42:14.069845 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:141:in `build_instances' +E, [2019-04-10T13:42:14.069892 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:117:in `instances' +E, [2019-04-10T13:42:14.069934 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:112:in `filtered_instances' +E, [2019-04-10T13:42:14.069977 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:142:in `parse_subcommand' +E, [2019-04-10T13:42:14.070019 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command/list.rb:30:in `call' +E, [2019-04-10T13:42:14.070060 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/cli.rb:52:in `perform' +E, [2019-04-10T13:42:14.070102 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/cli.rb:120:in `list' +E, [2019-04-10T13:42:14.070144 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' +E, [2019-04-10T13:42:14.070186 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' +E, [2019-04-10T13:42:14.070229 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' +E, [2019-04-10T13:42:14.070333 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' +E, [2019-04-10T13:42:14.070440 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/bin/kitchen:13:in `block in ' +E, [2019-04-10T13:42:14.070549 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/errors.rb:171:in `with_friendly_errors' +E, [2019-04-10T13:42:14.070609 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/bin/kitchen:13:in `' +E, [2019-04-10T13:42:14.070657 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/bin/kitchen:322:in `load' +E, [2019-04-10T13:42:14.070711 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/bin/kitchen:322:in `
' +E, [2019-04-10T13:42:14.070754 #11604] ERROR -- Kitchen: ----End Backtrace----- diff --git a/Version 1.3.11.843 b/Version 1.3.11.843 new file mode 100644 index 0000000..e69de29 diff --git a/Version 1.3.12.915 b/Version 1.3.12.915 new file mode 100644 index 0000000..e69de29 diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 154dee3..6f2ed30 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -65,13 +65,17 @@ exit /b echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle" - set CMDER_CLINK=1 - if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 - if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 + if not defined CMDER_CLINK ( + set CMDER_CLINK=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 + ) - set CMDER_ALIASES=1 - if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 - if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 + if not defined CMDER_ALIASES ( + set CMDER_ALIASES=1 + if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 + if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 + ) exit /b From c499456f97468833856ef2ff6392d49b0fb69938 Mon Sep 17 00:00:00 2001 From: Dax Games Date: Thu, 22 Aug 2019 06:24:49 -0400 Subject: [PATCH 157/371] cleanup --- .kitchen/logs/kitchen.log | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .kitchen/logs/kitchen.log diff --git a/.kitchen/logs/kitchen.log b/.kitchen/logs/kitchen.log deleted file mode 100644 index b499d0b..0000000 --- a/.kitchen/logs/kitchen.log +++ /dev/null @@ -1,26 +0,0 @@ -E, [2019-04-10T13:42:14.068995 #11604] ERROR -- Kitchen: ------Exception------- -E, [2019-04-10T13:42:14.069283 #11604] ERROR -- Kitchen: Class: Kitchen::UserError -E, [2019-04-10T13:42:14.069377 #11604] ERROR -- Kitchen: Message: Kitchen YAML file C:/tools/Cmder/.kitchen.yml does not exist. -E, [2019-04-10T13:42:14.069453 #11604] ERROR -- Kitchen: ---------------------- -E, [2019-04-10T13:42:14.069523 #11604] ERROR -- Kitchen: ------Backtrace------- -E, [2019-04-10T13:42:14.069657 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/loader/yaml.rb:65:in `read' -E, [2019-04-10T13:42:14.069713 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:152:in `data' -E, [2019-04-10T13:42:14.069760 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:131:in `suites' -E, [2019-04-10T13:42:14.069803 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:182:in `filter_instances' -E, [2019-04-10T13:42:14.069845 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:141:in `build_instances' -E, [2019-04-10T13:42:14.069892 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/config.rb:117:in `instances' -E, [2019-04-10T13:42:14.069934 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:112:in `filtered_instances' -E, [2019-04-10T13:42:14.069977 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:142:in `parse_subcommand' -E, [2019-04-10T13:42:14.070019 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command/list.rb:30:in `call' -E, [2019-04-10T13:42:14.070060 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/cli.rb:52:in `perform' -E, [2019-04-10T13:42:14.070102 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/cli.rb:120:in `list' -E, [2019-04-10T13:42:14.070144 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' -E, [2019-04-10T13:42:14.070186 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' -E, [2019-04-10T13:42:14.070229 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' -E, [2019-04-10T13:42:14.070333 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' -E, [2019-04-10T13:42:14.070440 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/bin/kitchen:13:in `block in ' -E, [2019-04-10T13:42:14.070549 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/errors.rb:171:in `with_friendly_errors' -E, [2019-04-10T13:42:14.070609 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.24.0/bin/kitchen:13:in `' -E, [2019-04-10T13:42:14.070657 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/bin/kitchen:322:in `load' -E, [2019-04-10T13:42:14.070711 #11604] ERROR -- Kitchen: C:/opscode/chef-workstation/bin/kitchen:322:in `
' -E, [2019-04-10T13:42:14.070754 #11604] ERROR -- Kitchen: ----End Backtrace----- From 22afc40a08bea19fc814d1f7cae45db9cb5e389e Mon Sep 17 00:00:00 2001 From: Dax Games Date: Thu, 22 Aug 2019 06:27:39 -0400 Subject: [PATCH 158/371] cleanup --- Version 1.3.11.843 | 0 Version 1.3.12.915 | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Version 1.3.11.843 delete mode 100644 Version 1.3.12.915 diff --git a/Version 1.3.11.843 b/Version 1.3.11.843 deleted file mode 100644 index e69de29..0000000 diff --git a/Version 1.3.12.915 b/Version 1.3.12.915 deleted file mode 100644 index e69de29..0000000 From b310a2c47c634265c0a6957ef2ec0a6134db3306 Mon Sep 17 00:00:00 2001 From: Matt Covalt Date: Thu, 29 Aug 2019 12:48:52 -0400 Subject: [PATCH 159/371] Disable clink logging --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index d0737dd..c91fa33 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -141,14 +141,14 @@ if "%CMDER_CLINK%" == "1" ( copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" --nolog ) else ( if not exist "%CMDER_ROOT%\config\settings" ( echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" --nolog ) ) else ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" From 19a2fd11e312cc2f1eceef51071b0293fc4be55d Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Fri, 27 Sep 2019 20:21:47 -0400 Subject: [PATCH 160/371] Clink Completions 0.3.4 (#2177) * update Changelog, clink-completions 0.3.4, fix ps fg color * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 12 +++++++++++- vendor/profile.ps1 | 1 + vendor/sources.json | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ad2f2..2c1ae30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log -## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-18) +## [Unreleased] + +* Update Clink Completions to 0.3.4 +* Fix powershell foreground color changing to green + +## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.11) (2019-08-18) ### Fixes @@ -33,6 +38,11 @@ * Syntax: `/x [ConEmu extras arguments]` * e.g.: `Cmder.exe /x "-min -tsa"` +* Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072) + * New alias create [alias] [alias command] syntax + * Based on [#1750](https://github.com/cmderdev/cmder/pull/1750) + * Syntax: `alias create [alias] [alias command]` + ## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22) ### Fixes diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index b9ac89d..aa90974 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -177,6 +177,7 @@ if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionS [ScriptBlock]$PostPrompt = {} [ScriptBlock]$CmderPrompt = { $Host.UI.RawUI.ForegroundColor = "White" + Write-Host -NoNewline "$([char]0x200B)" Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green if (get-command git -erroraction silentlycontinue) { checkGit($pwd.ProviderPath) diff --git a/vendor/sources.json b/vendor/sources.json index b8f3f8a..bd864e7 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -16,7 +16,7 @@ }, { "name": "clink-completions", - "version": "0.3.3", - "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.3.zip" + "version": "0.3.4", + "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.4.zip" } ] From e4651cf7b4928515eef3df52d90027bb8f92e715 Mon Sep 17 00:00:00 2001 From: mdavis199 <546489+mdavis199@users.noreply.github.com> Date: Sun, 6 Oct 2019 16:52:50 -0400 Subject: [PATCH 161/371] Bare doubledash for conemu commands (#2174) * Add bare doubledash command line option The '--' parameter is a common POSIX-style option. All command-line parameters after the double dash will be joined by a space and forwarded to conemu. * add bare doubledash command line option The "--" option indicates that the remaining portion of the command line is forwarded to conemu. Quotes and spacing is retained. * move all doubledash related code together * remove unused variable --- launcher/src/CmderLauncher.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index de10d04..86ba8f3 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -633,6 +633,17 @@ cmderOptions GetOption() cmderOptions.cmderConEmuArgs = szArgList[i + 1]; i++; } + /* Bare double dash, remaining commandline is for conemu */ + else if (_wcsicmp(L"--", szArgList[i]) == 0) + { + std::wstring cmdline = std::wstring(GetCommandLineW()); + auto doubledash = cmdline.find(L" -- "); + if (doubledash != std::string::npos) + { + cmderOptions.cmderConEmuArgs = cmdline.substr(doubledash + 4); + } + break; + } else if (cmderOptions.cmderStart == L"") { int len = wcslen(szArgList[i]); From 035f209bc4bcd7eeb2aab9166604d45c4971f280 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Sat, 12 Oct 2019 19:43:46 +0200 Subject: [PATCH 162/371] :arrow_up: Update Git to 2.23.0 Release Notes: https://github.com/git-for-windows/git/releases/tag/v2.23.0.windows.1 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index bd864e7..a45f021 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.21.0.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/PortableGit-2.21.0-64-bit.7z.exe" + "version": "v2.23.0.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.23.0.windows.1/PortableGit-2.23.0-64-bit.7z.exe" }, { "name": "clink", From 4575ac3209f7d513504bcaf80b41ef1106c9406a Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Sat, 12 Oct 2019 19:45:23 +0200 Subject: [PATCH 163/371] :arrow_up: Update ConEmu to 190714 Release Notes: https://conemu.github.io/en/Whats_New.html --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index a45f021..8726e2e 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -11,8 +11,8 @@ }, { "name": "conemu-maximus5", - "version": "180626", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v18.06.26/ConEmuPack.180626.7z" + "version": "190714", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v19.07.14/ConEmuPack.190714.7z" }, { "name": "clink-completions", From 3736508b2c29c84c04f8d4785a0e93e20b260cb7 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Mon, 14 Oct 2019 21:07:55 +0330 Subject: [PATCH 164/371] Update template issue (#2189) * fix unclear guide * m. update --- .github/issue_template.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index e3fc4e5..a6576ce 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -84,7 +84,10 @@ ### Purpose of the issue @@ -101,9 +105,9 @@ - [ ] Question ### Version Information - + - + ### Description of the issue - + From 7f69f156372de21a005f9366f2a9c7334f959d71 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Tue, 22 Oct 2019 11:17:13 -0400 Subject: [PATCH 165/371] Fix #2192: Set default prompt hooks before loading user profile --- vendor/profile.ps1 | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index aa90974..c0dbfb1 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -44,7 +44,7 @@ function Configure-Git($GIT_INSTALL_ROOT){ if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" } - + # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" @@ -96,6 +96,18 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { Set-PSReadlineOption -ExtraPromptLineCount 1 } +# Pre assign default prompt hooks so the first run of cmder gets a working prompt. +[ScriptBlock]$PrePrompt = {} +[ScriptBlock]$PostPrompt = {} +[ScriptBlock]$CmderPrompt = { + $Host.UI.RawUI.ForegroundColor = "White" + Write-Host -NoNewline "$([char]0x200B)" + Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green + if (get-command git -erroraction silentlycontinue) { + checkGit($pwd.ProviderPath) + } +} + # Enhance Path $env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT" @@ -172,17 +184,6 @@ if (! (Test-Path $CmderUserProfilePath) ) { # This allows users to configure the prompt in their user_profile.ps1 or config\profile.d\*.ps1 if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionState.Path.CurrentLocation\)\$\(' -and ` $(get-command prompt).Definition -match '\(\$nestedPromptLevel \+ 1\)\) ";') { - # Pre assign the hooks so the first run of cmder gets a working prompt. - [ScriptBlock]$PrePrompt = {} - [ScriptBlock]$PostPrompt = {} - [ScriptBlock]$CmderPrompt = { - $Host.UI.RawUI.ForegroundColor = "White" - Write-Host -NoNewline "$([char]0x200B)" - Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green - if (get-command git -erroraction silentlycontinue) { - checkGit($pwd.ProviderPath) - } - } <# This scriptblock runs every time the prompt is returned. From 46c80993176cc328ac974c915b56cce304ca5e63 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Tue, 22 Oct 2019 22:41:44 -0400 Subject: [PATCH 166/371] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87c3cca..8a53ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ * Update Clink Completions to 0.3.4 * Fix powershell foreground color changing to green -## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-18) +## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-19) ### Fixes From f1a97212566474d6335ce5f2044552aa0d995c7f Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Tue, 22 Oct 2019 22:44:17 -0400 Subject: [PATCH 167/371] Update init.bat --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index fd7ef4e..2882480 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -188,7 +188,7 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( call :compare_git_versions ) - +:: our last hope: our own git... :VENDORED_GIT if exist "%CMDER_ROOT%\vendor\git-for-windows" ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" From 06b0c0d3c24855328c3a9f41112aff36410485b0 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 27 Oct 2019 16:43:51 -0400 Subject: [PATCH 168/371] cleanup --- config/Readme.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/Readme.md b/config/Readme.md index d123efc..c8befd2 100644 --- a/config/Readme.md +++ b/config/Readme.md @@ -3,13 +3,14 @@ All config files must be in this folder. If there is no option to set this folder directly, it has to be hardlinked. -* `user-aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from - `vendor\user-aliases.cmd.default`. +* `user_aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from + `vendor\user_aliases.cmd.default`. * `*.lua`: clink completions and prompt filters; autoloaded after all prompt filter and clink completions are initialized; add your own. -* `user-profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their +* `user_profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their respective startup scripts in `vendor\`; autocreated from - `vendor\user-profile.{sh|cmd|ps1}.default` on first start of such a task. + `vendor\user_profile.{sh|cmd|ps1}.default` on first start of such a task. * `.history`: the current commandline history; autoupdated on close. * `settings`: settings for readline; overwritten on update. -* `ConEmu.xml`: settings from ConEmu (=the UI of cmder -> Preferences); overwritten on update. +* `user-ConEmu.xml`: settings from ConEmu the UI of Cmder. ; + Do not edit this file directly it is overwritten on each cmder.exe launch. From f1b1ac0ec10a7a726d6e26fb55501f2341181bf9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 27 Oct 2019 16:57:28 -0400 Subject: [PATCH 169/371] CHAMGELOG.md --- CHANGELOG.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a53ae2..e7fff78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,21 @@ ## [Unreleased] -* Update Clink Completions to 0.3.4 -* Fix powershell foreground color changing to green +## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-10-27) + +### Adds + +* #2174 `--` Syntax to pass command line options to Conemu. +* Disable Clink Logging + + +### Fixes + +* Fix #2192: Set default prompt hooks before loading user profile +* Fix #2097, #1899: powershell foreground color changing to green +* Fix #1979: Update Clink Completions to 0.3.4 +* Fix #1678: Cmder corrupting path with `!` in Cmder folder path. + ## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-19) From 8cf51e454a6ce9fbb92a5c04d5ec4ef84ebe59d3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 27 Oct 2019 17:06:02 -0400 Subject: [PATCH 170/371] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7fff78..2c91809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * #2174 `--` Syntax to pass command line options to Conemu. * Disable Clink Logging +* Add `~` tab completion. ### Fixes From 44a8bf5802e7b4a7f094c28208144008fa28f57e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:00:10 -0500 Subject: [PATCH 171/371] add ability to disable git --- vendor/clink.lua | 57 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 5e47246..83f9387 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -280,6 +280,24 @@ local function get_svn_status() return true end +--- +-- Get the status of working dir +-- @return {bool} +--- +local function get_git_status_setting() + gitStatusSetting = io.popen("git config cmder.status") + + for line in gitStatusSetting:lines() do + if string.match(line, 'false') then + gitStatusSetting:close() + return false + end + end + gitStatusSetting:close() + + return true +end + local function git_prompt_filter() -- Colors for git status @@ -290,27 +308,30 @@ local function git_prompt_filter() } local git_dir = get_git_dir() - if git_dir then - -- if we're inside of git repo then try to detect current branch - local branch = get_git_branch(git_dir) - local color - if branch then - -- Has branch => therefore it is a git folder, now figure out status - local gitStatus = get_git_status() - local gitConflict = get_git_conflict() - color = colors.dirty - if gitStatus then - color = colors.clean - end + if get_git_status_setting() then + if git_dir then + -- if we're inside of git repo then try to detect current branch + local branch = get_git_branch(git_dir) + local color + if branch then + -- Has branch => therefore it is a git folder, now figure out status + local gitStatus = get_git_status() + local gitConflict = get_git_conflict() - if gitConflict then - color = colors.conflict - end + color = colors.dirty + if gitStatus then + color = colors.clean + end - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") - return false - end + if gitConflict then + color = colors.conflict + end + + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") + return false + end + end end -- No git present or not in git file From 7877d417f87b7af2656bd3df42e65dc76f638fc3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:13:55 -0500 Subject: [PATCH 172/371] changelog --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c91809..e365746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,18 @@ ## [Unreleased] -## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-10-27) +## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-11-3) ### Adds +* #2197, #1364, #447 Add ability to disable git status either globally or for individual repos in `cmd::cmder*` sessions. + * To disable git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`: + + ``` + [cmder] + status = false + ``` + * #2174 `--` Syntax to pass command line options to Conemu. * Disable Clink Logging * Add `~` tab completion. From 60279fea04e0e83ad9a4459d926eebb6e4572f70 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:22:29 -0500 Subject: [PATCH 173/371] README.md --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2e0484b..3ef2d06 100644 --- a/README.md +++ b/README.md @@ -92,8 +92,8 @@ _(Some shortcuts are not yet documented, though they exist - please document the ### Access to multiple shells in one window using tabs You can open multiple tabs each containing one of the following shells: -| Task | Shell | Description | -| ---- | ----- | ----------- | +| Task | Shell | Description | +| ---- | ----- | ----------- | | Cmder | `cmd.exe` | Windows `cmd.exe` shell enhanced with Git, Git aware prompt, Clink (GNU Readline), and Aliases. | | Cmder as Admin | `cmd.exe` | Administrative Windows `cmd.exe` Cmder shell. | | PowerShell | `powershell.exe` | Windows PowerShell enhanced with Git and Git aware prompt . | @@ -176,6 +176,17 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t | PowerShell | `$ENV:CMDER_ROOT\config\profile.d\*.ps1` | | Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` | +#### Git Status Opt-Out for `Cmd::Cmder*` Sessions + + To disable git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`. + + *Note: theis configuration is not portable* + + ``` + [cmder] + status = false + ``` + ### Aliases #### Cmder(`Cmd.exe`) Aliases You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. From 74fcb5b62b0e8bc28f43bcfe90cfa2aa5b3022f1 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:23:37 -0500 Subject: [PATCH 174/371] README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ef2d06..4e440e9 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t To disable git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`. - *Note: theis configuration is not portable* + *Note: This configuration is not portable* ``` [cmder] From f1fbd980934dcb1cbfdbec7234b3e6429c0a3365 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:25:02 -0500 Subject: [PATCH 175/371] README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e440e9..45330b4 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t #### Git Status Opt-Out for `Cmd::Cmder*` Sessions - To disable git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`. + To disable Cmder prompt git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`. *Note: This configuration is not portable* From 788d4e0caa92bc05f8d7bd4e9041ddf104630e56 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:28:18 -0500 Subject: [PATCH 176/371] README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45330b4..2814335 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t #### Git Status Opt-Out for `Cmd::Cmder*` Sessions - To disable Cmder prompt git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`. + To disable Cmder prompt git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config` and start a new session. *Note: This configuration is not portable* From 5a6f873d2b1180a69ccc25ec96f4bc2fdf36ca9b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 11:29:18 -0500 Subject: [PATCH 177/371] README.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e365746..35f6e20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [Unreleased] -## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-11-3) +## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-11-03) ### Adds From 661f59d0fbf56a94c40ea1e43c5263ae5e26f88f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 12:36:28 -0500 Subject: [PATCH 178/371] Fix #2191 profile.ps1: CheckGit does not export $gitLoaded --- CHANGELOG.md | 1 + vendor/profile.ps1 | 48 +++++----------------------------------------- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35f6e20..2f443bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ ### Fixes +* Fix #2191: profile.ps1: CheckGit does not export $gitLoaded * Fix #2192: Set default prompt hooks before loading user profile * Fix #2097, #1899: powershell foreground color changing to green * Fix #1979: Update Clink Completions to 0.3.4 diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index c0dbfb1..4800ec1 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -32,53 +32,13 @@ $moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorActi # Add Cmder modules directory to the autoload path. $CmderModulePath = Join-path $PSScriptRoot "psmodules/" +$CmderFunctions = Join-Path $CmderModulePath "Cmder.ps1" +. $CmderFunctions + if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderModulePath) ){ $env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;") } -function Configure-Git($GIT_INSTALL_ROOT){ - $env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd") - - # Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already - $GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\') - if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" - } - - # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already - if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" - } elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin" - } -} - -$gitLoaded = $false -function Import-Git($Loaded){ - if($Loaded) { return } - $GitModule = Get-Module -Name Posh-Git -ListAvailable - if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ - Import-Module Posh-Git > $null - } - if(-not ($GitModule) ) { - Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder." - } - # Make sure we only run once by alawys returning true - return $true -} - -function checkGit($Path) { - if (Test-Path -Path (Join-Path $Path '.git') ) { - $gitLoaded = Import-Git $gitLoaded - Write-VcsStatus - return - } - $SplitPath = split-path $path - if ($SplitPath) { - checkGit($SplitPath) - } -} - try { # Check if git is on PATH, i.e. Git already installed on system Get-command -Name "git" -ErrorAction Stop >$null @@ -97,6 +57,8 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { } # Pre assign default prompt hooks so the first run of cmder gets a working prompt. +$gitLoaded = $false +$env:gitLoaded = $false [ScriptBlock]$PrePrompt = {} [ScriptBlock]$PostPrompt = {} [ScriptBlock]$CmderPrompt = { From dac4b27e283e8260994ca09d50cf4044bcbf878c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 12:59:36 -0500 Subject: [PATCH 179/371] separate powershell functions from profile.ps1 --- .gitignore | 2 +- vendor/psmodules/Cmder.ps1 | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 vendor/psmodules/Cmder.ps1 diff --git a/.gitignore b/.gitignore index 4a75750..bc4fb83 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ vendor/*/* !vendor/bin/* !vendor/lib/* !vendor/* -!vendor/psmodules/PsGet +!vendor/psmodules/* config/* !config/Readme.md diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 new file mode 100644 index 0000000..f9ddff1 --- /dev/null +++ b/vendor/psmodules/Cmder.ps1 @@ -0,0 +1,44 @@ +function Configure-Git($GIT_INSTALL_ROOT){ + $env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd") + + # Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already + $GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\') + if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { + $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" + } + + # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already + if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { + $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" + } elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) { + $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin" + } +} + +function Import-Git($Loaded){ + $GitModule = Get-Module -Name Posh-Git -ListAvailable + if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ + Import-Module Posh-Git > $null + } + if(-not ($GitModule) ) { + Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder." + } + # Make sure we only run once by alawys returning true + return $true +} + +function checkGit($Path) { + if (Test-Path -Path (Join-Path $Path '.git') ) { + if($env:gitLoaded -eq 'false') { + $env:gitLoaded = Import-Git $gitLoaded + } + Write-VcsStatus + return + } + $SplitPath = split-path $path + if ($SplitPath) { + checkGit($SplitPath) + } +} + + From 6ab4599a4deb279e5249e45d458fb77da7e9a8b6 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 13:07:20 -0500 Subject: [PATCH 180/371] separate powershell functions from profile.ps1 --- vendor/profile.ps1 | 1 - vendor/psmodules/Cmder.ps1 | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 4800ec1..87c7301 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -57,7 +57,6 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { } # Pre assign default prompt hooks so the first run of cmder gets a working prompt. -$gitLoaded = $false $env:gitLoaded = $false [ScriptBlock]$PrePrompt = {} [ScriptBlock]$PostPrompt = {} diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index f9ddff1..7d9d469 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -15,7 +15,7 @@ function Configure-Git($GIT_INSTALL_ROOT){ } } -function Import-Git($Loaded){ +function Import-Git(){ $GitModule = Get-Module -Name Posh-Git -ListAvailable if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ Import-Module Posh-Git > $null @@ -30,7 +30,7 @@ function Import-Git($Loaded){ function checkGit($Path) { if (Test-Path -Path (Join-Path $Path '.git') ) { if($env:gitLoaded -eq 'false') { - $env:gitLoaded = Import-Git $gitLoaded + $env:gitLoaded = Import-Git } Write-VcsStatus return From 44bc089ee4dbf3a9fef864f5909de7c38ff2d376 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 3 Nov 2019 14:14:47 -0500 Subject: [PATCH 181/371] move lambda to cmder prompt method for easier user change --- vendor/profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 87c7301..ad9182a 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -67,6 +67,7 @@ $env:gitLoaded = $false if (get-command git -erroraction silentlycontinue) { checkGit($pwd.ProviderPath) } + Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray" } # Enhance Path @@ -156,7 +157,6 @@ if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionS $host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline CmderPrompt - Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray" PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline $global:LASTEXITCODE = $realLASTEXITCODE return " " From 3ee244e4c1f6a5e31dff3190d6213219921066fc Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 9 Nov 2019 16:36:16 -0500 Subject: [PATCH 182/371] allow git prompt status opt out for powershell and bash --- vendor/git-prompt.sh | 25 +++++++++++++++++++++---- vendor/psmodules/Cmder.ps1 | 14 +++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/vendor/git-prompt.sh b/vendor/git-prompt.sh index 135e994..632c774 100644 --- a/vendor/git-prompt.sh +++ b/vendor/git-prompt.sh @@ -1,3 +1,14 @@ +function getGitStatusSetting() { + gitStatusSetting=$(git config cmder.status 2>/dev/null) + + if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} == false ]] + then + echo false + else + echo true + fi +} + if test -f /etc/profile.d/git-sdk.sh then TITLEPREFIX=SDK-${MSYSTEM#MINGW} @@ -7,7 +18,10 @@ fi if test -f ~/.config/git/git-prompt.sh then - . ~/.config/git/git-prompt.sh + if [[ $(getGitStatusSetting) == true ]] + then + . ~/.config/git/git-prompt.sh + fi else PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title # PS1="$PS1"'\n' # new line @@ -26,9 +40,12 @@ else if test -f "$COMPLETION_PATH/git-prompt.sh" then . "$COMPLETION_PATH/git-completion.bash" - . "$COMPLETION_PATH/git-prompt.sh" - PS1="$PS1"'\[\033[36m\]' # change color to cyan - PS1="$PS1"'`__git_ps1`' # bash function + if [[ $(getGitStatusSetting) == true ]] + then + . "$COMPLETION_PATH/git-prompt.sh" + PS1="$PS1"'\[\033[36m\]' # change color to cyan + PS1="$PS1"'`__git_ps1`' # bash function + fi fi fi PS1="$PS1"'\[\033[0m\]' # change color diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index 7d9d469..e1954dd 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -32,7 +32,11 @@ function checkGit($Path) { if($env:gitLoaded -eq 'false') { $env:gitLoaded = Import-Git } - Write-VcsStatus + + if (getGitStatusSetting -eq $true) { + Write-VcsStatus + } + return } $SplitPath = split-path $path @@ -41,4 +45,12 @@ function checkGit($Path) { } } +function getGitStatusSetting() { + $gitStatus = (git config cmder.status) | out-string + if (($gitStatus -replace "`n" -replace "`r") -eq "false") { + return $false + } else { + return $true + } +} From c04cc6dc7fe24e8a166bda3b670f4de8ff385e8e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 9 Nov 2019 16:39:57 -0500 Subject: [PATCH 183/371] allow git prompt status opt out for powershell and bash --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2814335..5fdc080 100644 --- a/README.md +++ b/README.md @@ -164,19 +164,19 @@ Single user portable configuration is possible using the cmder specific shell co | ------------- | ----------------------------------------- | | Cmder | `%CMDER_ROOT%\config\user_profile.cmd` | | PowerShell | `$ENV:CMDER_ROOT\config\user_profile.ps1` | -| Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` | +| Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` | Note: Bash and Mintty sessions will also source the `$HOME/.bashrc` file if it exists after it sources `$CMDER_ROOT/config/user_profile.sh`. You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in the `%CMDER_ROOT%\config\profile.d` folder to add startup config to Cmder. -| Shell | Cmder `Profile.d` Scripts | -| ------------- | --------------------------------------------------| -| Cmder | `%CMDER_ROOT%\config\profile.d\*.bat and *.cmd` | -| PowerShell | `$ENV:CMDER_ROOT\config\profile.d\*.ps1` | -| Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` | +| Shell | Cmder `Profile.d` Scripts | +| ------------- | -------------------------------------------------- | +| Cmder | `%CMDER_ROOT%\config\profile.d\*.bat and *.cmd` | +| PowerShell | `$ENV:CMDER_ROOT\config\profile.d\*.ps1` | +| Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` | -#### Git Status Opt-Out for `Cmd::Cmder*` Sessions +#### Git Status Opt-Out To disable Cmder prompt git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config` and start a new session. From 9724151f06eef3a520d1b8e75e7b58512eab805a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 9 Nov 2019 16:40:55 -0500 Subject: [PATCH 184/371] allow git prompt status opt out for powershell and bash --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f443bd..c71b063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Adds -* #2197, #1364, #447 Add ability to disable git status either globally or for individual repos in `cmd::cmder*` sessions. +* #2197, #1364, #447 Add ability to disable git status either globally or for individual repos. * To disable git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`: ``` From 589b48d06ec6db87385c5f4391c5802f9104104e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 9 Nov 2019 17:50:57 -0500 Subject: [PATCH 185/371] update conemu --- CHANGELOG.md | 4 ++++ vendor/sources.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c71b063..a9a4842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-11-03) +### Changes + +* Update to Conemu 19.10.12 + ### Adds * #2197, #1364, #447 Add ability to disable git status either globally or for individual repos. diff --git a/vendor/sources.json b/vendor/sources.json index 8726e2e..5727306 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -11,8 +11,8 @@ }, { "name": "conemu-maximus5", - "version": "190714", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v19.07.14/ConEmuPack.190714.7z" + "version": "191012", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v19.10.12/ConEmuPack.191012.7z" }, { "name": "clink-completions", From 2428e8529f67b1e4ffb406c69789794ac59e7171 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 23 Nov 2019 11:54:53 -0500 Subject: [PATCH 186/371] dd per shell git opt out --- README.md | 5 ++++- vendor/clink.lua | 4 ++-- vendor/git-prompt.sh | 4 ++-- vendor/psmodules/Cmder.ps1 | 13 ++++++++----- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5fdc080..753e5eb 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,10 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t ``` [cmder] - status = false + status = false # Opt out of Git status for 'ALL' Cmder supported shells. + cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells. + psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells. + shstatus = false # Opt out of Git status for 'bash.exe' shells. ``` ### Aliases diff --git a/vendor/clink.lua b/vendor/clink.lua index 83f9387..76904c3 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -285,10 +285,10 @@ end -- @return {bool} --- local function get_git_status_setting() - gitStatusSetting = io.popen("git config cmder.status") + gitStatusSetting = io.popen("git --no-pager config -l") for line in gitStatusSetting:lines() do - if string.match(line, 'false') then + if string.match(line, 'cmder.status=false') or string.match(line, 'cmder.cmdstatus=false') then gitStatusSetting:close() return false end diff --git a/vendor/git-prompt.sh b/vendor/git-prompt.sh index 632c774..c41a5a1 100644 --- a/vendor/git-prompt.sh +++ b/vendor/git-prompt.sh @@ -1,7 +1,7 @@ function getGitStatusSetting() { - gitStatusSetting=$(git config cmder.status 2>/dev/null) + gitStatusSetting=$(git --no-pager config -l 2>/dev/null) - if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} == false ]] + if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} =~ cmder.status=false ]] || [[ ${gitStatusSetting} =~ cmder.shstatus=false ]] then echo false else diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index e1954dd..86dfb02 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -16,6 +16,7 @@ function Configure-Git($GIT_INSTALL_ROOT){ } function Import-Git(){ + $GitModule = Get-Module -Name Posh-Git -ListAvailable if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ Import-Module Posh-Git > $null @@ -46,11 +47,13 @@ function checkGit($Path) { } function getGitStatusSetting() { - $gitStatus = (git config cmder.status) | out-string + $gitStatus = (git --no-pager config -l) | out-string - if (($gitStatus -replace "`n" -replace "`r") -eq "false") { - return $false - } else { - return $true + ForEach ($line in $($gitStatus -split "`r`n")) { + if ($line -match 'cmder.status=false' -or $line -match 'cmder.psstatus=false') { + return $false + } } + + return $true } From 0cf1c5e2ebcbc2b48e9b4ecb75ee7790c3c8c57c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 23 Nov 2019 18:13:03 -0500 Subject: [PATCH 187/371] fix --- vendor/clink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 76904c3..c029966 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -285,7 +285,7 @@ end -- @return {bool} --- local function get_git_status_setting() - gitStatusSetting = io.popen("git --no-pager config -l") + gitStatusSetting = io.popen("git --no-pager config -l 2>nul") for line in gitStatusSetting:lines() do if string.match(line, 'cmder.status=false') or string.match(line, 'cmder.cmdstatus=false') then From a857d8419cf94190f74ba86acb4840c05427a9e9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 4 Dec 2019 16:04:16 -0500 Subject: [PATCH 188/371] fixes for cmd:cmder init script --- vendor/init.bat | 16 +++++++----- vendor/lib/lib_path.cmd | 58 +++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 2882480..8b0a885 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -232,15 +232,17 @@ if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" :: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe" -if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F") +if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" ) if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale -if not defined git_locale set git_locale=env /usr/bin/locale +if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" /usr/bin/locale ) -%lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" -if not defined LANG ( - for /F "delims=" %%F in ('%git_locale% -uU 2') do ( - set "LANG=%%F" - ) +if defined git_locale ( + %lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" + if not defined LANG ( + for /F "delims=" %%F in ('%git_locale% -uU 2') do ( + set "LANG=%%F" + ) + ) ) %lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 8f7188c..a1a8fbe 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -57,39 +57,38 @@ exit /b ) else ( set "PATH=%add_path%;%PATH%" ) + goto :end_enhance_path ) - set "PATH=%PATH:;;=;%" - if "%fast_init%" == "1" ( - exit /b - ) - - rem setlocal enabledelayedexpansion - set found=0 set "find_query=%add_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" + set OLD_PATH=%PATH% - if "%CMDER_CONFIGURED%" == "1" ( - %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%" - echo "%path%"|%WINDIR%\System32\findstr >nul /I /R ";%find_query%\"$" - REM if "!ERRORLEVEL!" == "0" set found=1 + setlocal enabledelayedexpansion + if "%found%" == "0" ( + echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;" call :set_found ) - %lib_console% debug_output :enhance_path "Env Var 1 - found=%found%" + %lib_console% debug_output :enhance_path "Env Var INSIDE PATH %find_query% - found=%found%" - if "%found%" == "0" ( - if "%CMDER_CONFIGURED%" == "1" ( - echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;" - REM if "!ERRORLEVEL!" == "0" set found=1 - call :set_found - ) - %lib_console% debug_output :enhance_path "Env Var 2 - found=%found%" + if /i "%position%" == "append" ( + if "!found!" == "0" ( + echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%\"$" + call :set_found + ) + %lib_console% debug_output :enhance_path "Env Var END PATH %find_query% - found=!found!" + ) else ( + if "!found!" == "0" ( + echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:"^\"%find_query%;" + call :set_found + ) + %lib_console% debug_output :enhance_path "Env Var BEGIN PATH %find_query% - found=!found!" ) + endlocal & set found=%found% if "%found%" == "0" ( - %lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=%path%" if /i "%position%" == "append" ( %lib_console% debug_output :enhance_path "Appending '%add_path%'" set "PATH=%PATH%;%add_path%" @@ -98,16 +97,23 @@ exit /b set "PATH=%add_path%;%PATH%" ) - %lib_console% debug_output :enhance_path "AFTER Env Var - PATH=%path%" + set found=1 ) - rem :end_enhance_path - rem endlocal & set "PATH=%PATH:;;=;%" + :end_enhance_path set "PATH=%PATH:;;=;%" + if NOT "%OLD_PATH%" == "%PATH%" ( + %lib_console% debug_output :enhance_path "END Env Var - PATH=%path%" + %lib_console% debug_output :enhance_path "Env Var %find_query% - found=%found%" + ) + set "position=" exit /b :set_found - if "!ERRORLEVEL!" == "0" set found=1 + if "%ERRORLEVEL%" == "0" ( + set found=1 + ) + exit /b :enhance_path_recursive @@ -165,7 +171,6 @@ exit /b exit /b ) - rem setlocal enabledelayedexpansion if "%depth%" == "" set depth=0 %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%" @@ -175,13 +180,10 @@ exit /b if %max_depth% gtr %depth% ( %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'" call :enhance_path "%add_path%" %position% - REM set /a "depth=!depth!+1" call :set_depth call :loop_depth ) - rem :end_enhance_path_recursive - rem endlocal & set "PATH=%PATH%" set "PATH=%PATH%" exit /b From 9b29668250a4e4dd311d6ca25278bb9288734806 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 4 Dec 2019 16:09:38 -0500 Subject: [PATCH 189/371] fixes for cmd:cmder init script --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9a4842..a475827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ ## [Unreleased] -## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-11-03) +### Fixes + +* #2218 Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) +* #2220 Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) + +## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.13) (2019-11-03) ### Changes From 750560851f6d165a158a6c6e6b0e9a5aaf6697dd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 4 Dec 2019 16:13:08 -0500 Subject: [PATCH 190/371] fixes for cmd:cmder init script --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a475827..a474010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ ### Fixes -* #2218 Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) -* #2220 Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) +* Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) +* Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) ## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.13) (2019-11-03) From 84917159ec61f80044733e88918745cb10f5bd97 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 4 Dec 2019 16:14:36 -0500 Subject: [PATCH 191/371] fixes for cmd:cmder init script --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a474010..7e495b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ ### Fixes -* Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) -* Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) +* Pull Request: [#2222](https://github.com/cmderdev/cmder/pull/2222) + * Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) + * Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) ## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.13) (2019-11-03) From 8df688badaa8a5c9b9677f47c276d900dd2e7750 Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Thu, 5 Dec 2019 10:53:32 +0300 Subject: [PATCH 192/371] Update clink-completions https://github.com/vladimir-kotikov/clink-completions/releases/tag/0.3.5 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 5727306..41269ca 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -16,7 +16,7 @@ }, { "name": "clink-completions", - "version": "0.3.4", - "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.4.zip" + "version": "0.3.5", + "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.5.zip" } ] From 93cf865071149c5334ab2cbb7b3d6cdb2d62bc3f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Jan 2020 16:41:02 -0500 Subject: [PATCH 193/371] post-install fixes --- vendor/init.bat | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 8b0a885..cdac288 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -316,8 +316,14 @@ call "%user_aliases%" :: Basically we need to execute this post-install.bat because we are :: manually extracting the archive rather than executing the 7z sfx if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - echo Running Git for Windows one time Post Install.... + echo Running Git for Windows one time post install - %GIT_INSTALL_ROOT%\post-install.bat".... pushd "%GIT_INSTALL_ROOT%\" + copy post-install.bat post-install.cmder-bak.bat + if not exist "etc\post-install-cmder.bak" ( + md etc\post-install-cmder.bak + ) + xcopy etc\post-install\* etc\post-install-cmder.bak + copy post-install.bat post-install.cmder-bak.bat "%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat popd ) From 180e72a6aa0a9e5affaf8d2cf3e1fd272e2127fd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Jan 2020 13:52:23 -0800 Subject: [PATCH 194/371] revert --no-log to fix windows 7 clink prompt --- vendor/init.bat | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index cdac288..3c97cb5 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -141,14 +141,14 @@ if "%CMDER_CLINK%" == "1" ( copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" --nolog + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" ) else ( if not exist "%CMDER_ROOT%\config\settings" ( echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" --nolog + "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) ) else ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" @@ -192,13 +192,14 @@ 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 '%GIT_VERSION_VENDORED%'..." goto :CONFIGURE_GIT ) else ( goto :NO_GIT ) :SPECIFIED_GIT -%lib_console% debug_output "Using /GIT_INSTALL_ROOT from '%GIT_INSTALL_ROOT%..." +%lib_console% debug_output "Using /GIT_INSTALL_ROOT..." goto :CONFIGURE_GIT :FOUND_GIT @@ -206,6 +207,7 @@ goto :CONFIGURE_GIT goto :CONFIGURE_GIT :CONFIGURE_GIT +%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." :: Add git to the path rem add the unix commands at the end to not shadow windows commands like more if %nix_tools% equ 1 ( @@ -316,14 +318,8 @@ call "%user_aliases%" :: Basically we need to execute this post-install.bat because we are :: manually extracting the archive rather than executing the 7z sfx if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - echo Running Git for Windows one time post install - %GIT_INSTALL_ROOT%\post-install.bat".... + echo Running Git for Windows one time Post Install.... pushd "%GIT_INSTALL_ROOT%\" - copy post-install.bat post-install.cmder-bak.bat - if not exist "etc\post-install-cmder.bak" ( - md etc\post-install-cmder.bak - ) - xcopy etc\post-install\* etc\post-install-cmder.bak - copy post-install.bat post-install.cmder-bak.bat "%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat popd ) @@ -413,6 +409,7 @@ exit /b set test_dir= ) ) else ( + :: compare the user git version against the vendored version :: if the user provided git executable is not found if %errorlevel% equ -255 ( call :verbose_output No git at "%git_executable%" found. @@ -422,7 +419,6 @@ exit /b exit /b :get_user_git_version - :: get the version information for the user provided git binary %lib_git% read_version USER "%test_dir%" %lib_git% validate_version USER %GIT_VERSION_USER% From fe3d2034ef364661c87a33bca77f2d846e8b50bb Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Mon, 6 Jan 2020 22:45:17 +0100 Subject: [PATCH 195/371] Bump git-for-windows to v2.24.1.windows.2 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 41269ca..565a1d0 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.23.0.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.23.0.windows.1/PortableGit-2.23.0-64-bit.7z.exe" + "version": "v2.24.1.windows.2", + "url": "https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/PortableGit-2.24.1.2-64-bit.7z.exe" }, { "name": "clink", From ec06f3e39b5e0b1186a4914ac0a192cf4d1dcc21 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Jan 2020 22:50:03 -0500 Subject: [PATCH 196/371] changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e495b6..c30fdc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,18 @@ # Change Log -## [Unreleased] +## [1.3.14-pre](https://github.com/cmderdev/cmder) [Unreleased] ### Fixes * Pull Request: [#2222](https://github.com/cmderdev/cmder/pull/2222) * Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) * Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) + * Latest addition of "--nolog" clink breaks cmd prompts. [#2166](https://github.com/cmderdev/cmder/issues/2166) + +### Changes + +* Update Git for Windows to 2.24.1.windows.2 + * Pull Request: [#2237](https://github.com/cmderdev/cmder/pull/2237) ## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.13) (2019-11-03) From 492fc284f28edfed5b0caa0ad3b1c408b6175349 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Jan 2020 22:57:29 -0500 Subject: [PATCH 197/371] Fix issue #2214 --- CHANGELOG.md | 1 + vendor/init.bat | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c30fdc3..0cbce87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218) * Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220) * Latest addition of "--nolog" clink breaks cmd prompts. [#2166](https://github.com/cmderdev/cmder/issues/2166) + * `/nix_tools 0` should prevent adding `%GIT_INSTALL_ROOT%\mingw64\bin` to PATH. [#2214](https://github.com/cmderdev/cmder/issues/2214) ### Changes diff --git a/vendor/init.bat b/vendor/init.bat index 3c97cb5..c6f519d 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -219,13 +219,13 @@ if %nix_tools% equ 1 ( ) if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position% -if exist "%GIT_INSTALL_ROOT%\mingw32" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% -) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position% -) - if %nix_tools% geq 1 ( + if exist "%GIT_INSTALL_ROOT%\mingw32" ( + %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% + ) 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%\usr\bin" %path_position% ) From ca2550b70e7dee68325333500b7eee639cfdbaa4 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Jan 2020 23:03:11 -0500 Subject: [PATCH 198/371] Fix issue #2214 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cbce87..9783110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [1.3.14-pre](https://github.com/cmderdev/cmder) [Unreleased] +## 1.3.14-pre [Unreleased] ### Fixes From 638d82e9897864935480a81b6c0b20b0e883b3ff Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Wed, 8 Jan 2020 21:43:09 -0500 Subject: [PATCH 199/371] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9783110..1593af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## 1.3.14-pre [Unreleased] +## [1.3.14](https://github.com/cmderdev/cmder/tree/v1.3.14) (2020-01-08) ### Fixes @@ -14,6 +14,8 @@ * Update Git for Windows to 2.24.1.windows.2 * Pull Request: [#2237](https://github.com/cmderdev/cmder/pull/2237) +* Update clink-completions to 0.3.5 + * Pull Request: [#2223](https://github.com/cmderdev/cmder/pull/2223) ## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.13) (2019-11-03) From 251968b4c6a420d2d2fc92a30e3c25c1abbe072b Mon Sep 17 00:00:00 2001 From: andyburgess Date: Fri, 21 Feb 2020 11:52:52 -0500 Subject: [PATCH 200/371] Fixes #2247, fixes #2254 --- vendor/init.bat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index c6f519d..cd4e080 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -188,6 +188,10 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( call :compare_git_versions ) +if defined GIT_INSTALL_ROOT ( + goto :FOUND_GIT +) + :: our last hope: our own git... :VENDORED_GIT if exist "%CMDER_ROOT%\vendor\git-for-windows" ( @@ -399,11 +403,9 @@ exit /b if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" set test_dir= - goto :FOUND_GIT ) else if %errorlevel% geq 0 ( set "GIT_INSTALL_ROOT=%test_dir%" set test_dir= - goto :FOUND_GIT ) else ( call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... set test_dir= From 1071221468f2f75f2b63e482deab69c9ca986219 Mon Sep 17 00:00:00 2001 From: Michael Roy Date: Sat, 14 Mar 2020 14:01:06 +0100 Subject: [PATCH 201/371] Fix an issue with clink.find_files() return order not always consistent, leading to .init.lua not being run first lua path being broken (#2278) --- vendor/clink.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vendor/clink.lua b/vendor/clink.lua index c029966..8d72186 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -431,6 +431,8 @@ clink.prompt.register_filter(svn_prompt_filter, 50) clink.prompt.register_filter(percent_prompt_filter, 51) local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/' +-- Execute '.init.lua' first to ensure package.path is set properly +dofile(completions_dir..'.init.lua') for _,lua_module in ipairs(clink.find_files(completions_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 From 93f8718489910f6edca23d0acaf20232f893df54 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Apr 2020 08:20:26 -0400 Subject: [PATCH 202/371] move git functions to git lib --- vendor/init.bat | 59 ++------------------------- vendor/lib/lib_git.cmd | 93 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 56 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index c6f519d..ea6ab7b 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -183,9 +183,9 @@ if defined GIT_INSTALL_ROOT ( :: check if git is in path... for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :: get the absolute path to the user provided git binary - call :is_git_shim "%%~dpF" - call :get_user_git_version - call :compare_git_versions + %lib_git% is_git_shim "%%~dpF" + %lib_git% get_user_git_version + %lib_git% compare_git_versions ) :: our last hope: our own git... @@ -371,56 +371,3 @@ if %time_init% gtr 0 ( "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% ) exit /b - -:is_git_shim - pushd "%~1" - :: check if there's shim - and if yes follow the path - setlocal enabledelayedexpansion - if exist git.shim ( - for /F "tokens=2 delims== " %%I in (git.shim) do ( - pushd %%~dpI - set "test_dir=!CD!" - popd - ) - ) else ( - set "test_dir=!CD!" - ) - endlocal & set "test_dir=%test_dir%" - - popd - exit /b - -:compare_git_versions - if %errorlevel% geq 0 ( - :: compare the user git version against the vendored version - %lib_git% compare_versions USER VENDORED - - :: use the user provided git if its version is greater than, or equal to the vendored git - if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( - set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" - set test_dir= - goto :FOUND_GIT - ) else if %errorlevel% geq 0 ( - set "GIT_INSTALL_ROOT=%test_dir%" - set test_dir= - goto :FOUND_GIT - ) else ( - call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... - set test_dir= - ) - ) else ( - :: compare the user git version against the vendored version - :: if the user provided git executable is not found - if %errorlevel% equ -255 ( - call :verbose_output No git at "%git_executable%" found. - set test_dir= - ) - ) - exit /b - -:get_user_git_version - :: get the version information for the user provided git binary - %lib_git% read_version USER "%test_dir%" - %lib_git% validate_version USER %GIT_VERSION_USER% - exit /b - diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 3f4cdef..ba5938b 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -183,3 +183,96 @@ exit /b :: looks like we have the same versions. endlocal & exit /b 0 + +:::=============================================================================== +:::is_git_shim +:::. +:::include: +:::. +::: call "$0" +:::. +:::usage: +:::. +::: %lib_git% is_git_shim [filepath] +:::. +:::required: +:::. +::: [filepath] +:::------------------------------------------------------------------------------- + +:is_git_shim + pushd "%~1" + :: check if there's shim - and if yes follow the path + setlocal enabledelayedexpansion + if exist git.shim ( + for /F "tokens=2 delims== " %%I in (git.shim) do ( + pushd %%~dpI + set "test_dir=!CD!" + popd + ) + ) else ( + set "test_dir=!CD!" + ) + endlocal & set "test_dir=%test_dir%" + + popd + exit /b + +:::=============================================================================== +:::compare_git_versions +:::. +:::include: +:::. +::: call "$0" +:::. +:::usage: +:::. +::: %lib_git% compare_git_versions +:::------------------------------------------------------------------------------- + +:compare_git_versions + if %errorlevel% geq 0 ( + :: compare the user git version against the vendored version + %lib_git% compare_versions USER VENDORED + + :: use the user provided git if its version is greater than, or equal to the vendored git + if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( + set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" + set test_dir= + goto :FOUND_GIT + ) else if %errorlevel% geq 0 ( + set "GIT_INSTALL_ROOT=%test_dir%" + set test_dir= + goto :FOUND_GIT + ) else ( + call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... + set test_dir= + ) + ) else ( + :: compare the user git version against the vendored version + :: if the user provided git executable is not found + if %errorlevel% equ -255 ( + call :verbose_output No git at "%git_executable%" found. + set test_dir= + ) + ) + exit /b + +:::=============================================================================== +:::get_user_git_version - get the version information for the user provided git binary +:::. +:::include: +:::. +::: call "$0" +:::. +:::usage: +:::. +::: %lib_git% get_user_git_version +:::------------------------------------------------------------------------------- + +:get_user_git_version + :: get the version information for the user provided git binary + %lib_git% read_version USER "%test_dir%" + %lib_git% validate_version USER %GIT_VERSION_USER% + exit /b + From 1af12666e496f367c8c9db85ce8907218ddaa3c3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Apr 2020 08:46:46 -0400 Subject: [PATCH 203/371] move git functions to git lib --- vendor/lib/lib_git.cmd | 2 -- 1 file changed, 2 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index ba5938b..239e853 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -239,11 +239,9 @@ exit /b if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" set test_dir= - goto :FOUND_GIT ) else if %errorlevel% geq 0 ( set "GIT_INSTALL_ROOT=%test_dir%" set test_dir= - goto :FOUND_GIT ) else ( call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... set test_dir= From be5ec648c488547926682f2f9cc81f8f2709c64d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 6 Apr 2020 10:15:00 -0400 Subject: [PATCH 204/371] Fix Cmder issue #2290 --- vendor/init.bat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 3ad00c8..6c3acdb 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -124,10 +124,10 @@ if defined CMDER_USER_CONFIG ( :: Pick right version of clink if "%PROCESSOR_ARCHITECTURE%"=="x86" ( - set architecture=86 + set clink_architecture=x86 set architecture_bits=32 ) else ( - set architecture=64 + set clink_architecture=x64 set architecture_bits=64 ) @@ -141,14 +141,14 @@ if "%CMDER_CLINK%" == "1" ( copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" ) else ( if not exist "%CMDER_ROOT%\config\settings" ( echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) - "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) ) else ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" @@ -374,4 +374,4 @@ set CMDER_INIT_END=%time% if %time_init% gtr 0 ( "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% ) -exit /b \ No newline at end of file +exit /b From 2936abe2a5c0a5d46e2b78ec6a581e4c939d0796 Mon Sep 17 00:00:00 2001 From: wtof Date: Tue, 28 Apr 2020 11:18:24 +0800 Subject: [PATCH 205/371] Update git for windows to 2.26.2 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 565a1d0..992f398 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.24.1.windows.2", - "url": "https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/PortableGit-2.24.1.2-64-bit.7z.exe" + "version": "v2.26.2.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-64-bit.7z.exe" }, { "name": "clink", From 1f5ea5e596feb82eb7be0e62e6f8800570629abf Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 29 Apr 2020 12:03:24 -0400 Subject: [PATCH 206/371] Fix and enhance enhance_path_recursive --- .gitignore | 2 ++ README.md | 22 ++++++++++---- opt/Readme.md | 5 ++++ vendor/init.bat | 6 ++-- vendor/lib/lib_path.cmd | 63 +++++++++++++++++++++++++++-------------- 5 files changed, 69 insertions(+), 29 deletions(-) create mode 100644 opt/Readme.md diff --git a/.gitignore b/.gitignore index bc4fb83..67678bb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ bin/* !bin/Readme.md +opt/* +!opt/Readme.md vendor/*/* !vendor/bin/* diff --git a/README.md b/README.md index 753e5eb..56f3949 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,29 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can ### Shared Cmder install with Non-Portable Individual User Config 1. Download the [latest release](https://github.com/cmderdev/cmder/releases/) 2. Extract the archive to a shared location. -3. (optional) Place your own executable files into the `%cmder_root%\bin` folder to be injected into your PATH. -4. (optional) Create `%userprofile%\cmder_config\bin` folder to be injected into individual users PATH. Default is to auto create this on first run. -5. (optional) Place your own executable files into the `%userprofile%\cmder_config\bin` folder to be injected into your PATH. -6. Run `Cmder.exe` with `/C` command line argument. Example: `cmder.exe /C %userprofile%\cmder_config` +3. (optional) Place your own executable files and custom app folders into the `%cmder_root%\bin`. See: [opt/README.md](./bin/README) + - This folder to be injected into your PATH by default. + - See `/max_depth [1-5]` in blow table to add subdirectories recursively. +4. (optional) Place your own custom app folders into the `%cmder_root%\opt`. See: [opt/README.md](./opt/README) + - This folder will NOT be injected into your PATH so you have total control of what gets added. +5. Run `Cmder.exe` with `/C` command line argument. Example: `cmder.exe /C %userprofile%\cmder_config` * This will create the following directory structure if it is missing. ``` c:\users\[username]\cmder_config ├───bin - └───config - └───profile.d + ├───config + │ └───profile.d + └───opt ``` + - (optional) Place your own executable files and custom app folders into `%userprofile%\cmder_config\bin`. + - This folder to be injected into your PATH by default. + - See `/max_depth [1-5]` in blow table to add subdirectories recursively. + - (optional) Place your own custom app folders into the `%user_profile%\cmder_config\opt`. + - This folder will NOT be injected into your PATH so you have total control of what gets added. + + * Both the shared install and the individual user config locations can contain a full set of init and profile.d scripts enabling shared config with user overrides. See below. ## Cmder.exe Command Line Arguments diff --git a/opt/Readme.md b/opt/Readme.md new file mode 100644 index 0000000..acf5fd7 --- /dev/null +++ b/opt/Readme.md @@ -0,0 +1,5 @@ +## Bin + +This folder is for optional user packages and will not be automatically injected into the PATH. + +Use `%lib_path% enhance_path "%cmder_root%\[path to folder]"` in `%cmder_root%\config\user_profile.cmd` or `%cmder_root%\config\profile.d\*.cmd` to add to the path. diff --git a/vendor/init.bat b/vendor/init.bat index 6c3acdb..8d36dc0 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -120,6 +120,8 @@ goto var_loop if defined CMDER_USER_CONFIG ( %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" + + if not exist "%CMDER_USER_CONFIG%\opt" md "%CMDER_USER_CONFIG%\opt" ) :: Pick right version of clink @@ -261,9 +263,9 @@ endlocal :PATH_ENHANCE %lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" -%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% +%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% if defined CMDER_USER_BIN ( - %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth% + %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% ) %lib_path% enhance_path "%CMDER_ROOT%" append diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index a1a8fbe..a8fe253 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -51,17 +51,26 @@ exit /b set "position=" ) + dir "%add_path%" | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL + if "%ERRORLEVEL%" == "0" ( + set "add_to_path=%add_path%" + ) else ( + set "add_to_path=" + ) + if "%fast_init%" == "1" ( if "%position%" == "append" ( - set "PATH=%PATH%;%add_path%" + set "PATH=%PATH%;%add_to_path%" ) else ( - set "PATH=%add_path%;%PATH%" + set "PATH=%add_to_path%;%PATH%" ) goto :end_enhance_path + ) else if "add_to_path" equ "" ( + goto :end_enhance_path ) set found=0 - set "find_query=%add_path%" + set "find_query=%add_to_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" set OLD_PATH=%PATH% @@ -90,11 +99,11 @@ exit /b if "%found%" == "0" ( if /i "%position%" == "append" ( - %lib_console% debug_output :enhance_path "Appending '%add_path%'" - set "PATH=%PATH%;%add_path%" + %lib_console% debug_output :enhance_path "Appending '%add_to_path%'" + set "PATH=%PATH%;%add_to_path%" ) else ( - %lib_console% debug_output :enhance_path "Prepending '%add_path%'" - set "PATH=%add_path%;%PATH%" + %lib_console% debug_output :enhance_path "Prepending '%add_to_path%'" + set "PATH=%add_to_path%;%PATH%" ) set found=1 @@ -150,20 +159,26 @@ exit /b exit 1 ) - if "%~2" gtr "1" ( - set "max_depth=%~2" - ) else ( - set "max_depth=1" - ) + set "depth=%~2" + set "max_depth=%~3" - if "%~3" neq "" if /i "%~3" == "append" ( - set "position=%~3" + if "%~4" neq "" if /i "%~4" == "append" ( + set "position=%~4" ) else ( set "position=" ) + dir "%add_path%" | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL + if "%ERRORLEVEL%" == "0" ( + set "add_to_path=%add_path%" + ) else ( + set "add_to_path=" + ) + if "%fast_init%" == "1" ( - call :enhance_path "%add_path%" %position% + if "%add_to_path%" neq "" ( + call :enhance_path "%add_to_path%" %position% + ) ) set "PATH=%PATH:;;=;%" @@ -171,20 +186,22 @@ exit /b exit /b ) - if "%depth%" == "" set depth=0 - - %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%" + %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_to_path%" %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%" + %lib_console% debug_output :enhance_path_recursive "Env Var - depth=%depth%" %lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%" if %max_depth% gtr %depth% ( - %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'" - call :enhance_path "%add_path%" %position% + if "%add_to_path%" neq "" ( + %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_to_path%'" + call :enhance_path "%add_to_path%" %position% + ) call :set_depth call :loop_depth ) set "PATH=%PATH%" + exit /b : set_depth @@ -192,10 +209,14 @@ exit /b exit /b :loop_depth + if %depth% == %max_depth% ( + exit /b + ) + for /d %%i in ("%add_path%\*") do ( %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=%depth%" %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'" - call :enhance_path_recursive "%%~fi" %max_depth% %position% + call :enhance_path_recursive "%%~fi" %depth% %max_depth% %position% %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=%depth%" ) exit /b From 18619834697cfa24521204f95f6bb53117adf775 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 29 Apr 2020 13:40:39 -0400 Subject: [PATCH 207/371] readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 56f3949..12a2545 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can 2. Extract the archive to a shared location. 3. (optional) Place your own executable files and custom app folders into the `%cmder_root%\bin`. See: [opt/README.md](./bin/README) - This folder to be injected into your PATH by default. - - See `/max_depth [1-5]` in blow table to add subdirectories recursively. + - See `/max_depth [1-5]` in 'Command Line Arguments for `init.bat`' table to add subdirectories recursively. 4. (optional) Place your own custom app folders into the `%cmder_root%\opt`. See: [opt/README.md](./opt/README) - This folder will NOT be injected into your PATH so you have total control of what gets added. 5. Run `Cmder.exe` with `/C` command line argument. Example: `cmder.exe /C %userprofile%\cmder_config` @@ -41,7 +41,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can - (optional) Place your own executable files and custom app folders into `%userprofile%\cmder_config\bin`. - This folder to be injected into your PATH by default. - - See `/max_depth [1-5]` in blow table to add subdirectories recursively. + - See `/max_depth [1-5]` in 'Command Line Arguments for `init.bat`' table to add subdirectories recursively. - (optional) Place your own custom app folders into the `%user_profile%\cmder_config\opt`. - This folder will NOT be injected into your PATH so you have total control of what gets added. From b91bb84f3d3f19d5783717f6dcc4435a0239e9fb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 10 May 2020 10:56:12 -0400 Subject: [PATCH 208/371] fix cexec.cmd --- vendor/bin/cexec.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index 02ecba5..ba69f3d 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -19,8 +19,8 @@ set "currenArgu=%~1" if /i "%currenArgu%" equ "/setPath" ( :: set %flag_exists% shortcut endlocal - set "ccall=call %~dp0cexec.cmd" - set "cexec=%~dp0cexec.cmd" + set "ccall=call ^"%~dp0cexec.cmd^"" + set "cexec=^"%~dp0cexec.cmd^"" ) else if /i "%currenArgu%" == "/?" ( goto :help ) else if /i "%currenArgu%" equ "/help" ( From a2ce74f9813c0540a79f76364c6730893cab77df Mon Sep 17 00:00:00 2001 From: Vijay <54742586+SVijayB@users.noreply.github.com> Date: Mon, 25 May 2020 00:27:53 +0530 Subject: [PATCH 209/371] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 753e5eb..7009f46 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t #### Cmder(`Cmd.exe`) Aliases You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. -Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for `cmd.exe` +Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/doskey) for additional details on complex aliases/macros for `cmd.exe` Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\user-aliases.cmd` file From 04c784cb16f7743cce10501e3d14bc32aed2c8cb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 7 Jun 2020 14:49:02 -0400 Subject: [PATCH 210/371] Allow setting cmder init.bat arg vars globally on windows. --- vendor/init.bat | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 8d36dc0..44242b3 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -9,13 +9,22 @@ set CMDER_INIT_START=%time% :: !!! 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. -set verbose_output=0 -set debug_output=0 -set time_init=0 -set fast_init=0 -set max_depth=1 -:: Add *nix tools to end of path. 0 turns off *nix tools. -set nix_tools=1 +if not defined verbose_output set verbose_output=0 + +:: Use /d command line arg or set to 1 for debug output to aid in debugging. +if not defined debug_output set debug_output=0 + +:: Use /t command line arg or set to 1 to display init time. +if not defined time_init set time_init=0 + +:: Use /f command line arg to speed up init at the expense of some functionality. +if not defined fast_init set fast_init=0 + +:: Use /max_depth 1-5 to set max recurse depth for calls to `enhance_path_recursive` +if not defined max_depth set max_depth=1 + +:: Add *nix tools to end of path. 0 turns off *nix tools, 2 adds *nix tools to the front of thr path. +if not defined nix_tools set nix_tools=1 set "CMDER_USER_FLAGS= " :: Find root dir From a999d17f7164c86baf9407f89c2d2953add66ab8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 7 Jun 2020 15:32:15 -0400 Subject: [PATCH 211/371] Allow setting cmder init.bat arg vars globally on windows. --- vendor/init.bat | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vendor/init.bat b/vendor/init.bat index 44242b3..aa999a9 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -25,6 +25,7 @@ if not defined max_depth set max_depth=1 :: Add *nix tools to end of path. 0 turns off *nix tools, 2 adds *nix tools to the front of thr path. if not defined nix_tools set nix_tools=1 + set "CMDER_USER_FLAGS= " :: Find root dir @@ -50,6 +51,12 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" +if "%CMDER_CONFIGURED%" == "1" ( + echo Cmder is already configured, skipping to user config! + + goto USER_CONFIG_START +) + :var_loop if "%~1" == "" ( goto :start @@ -272,6 +279,8 @@ endlocal :PATH_ENHANCE %lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" + +:USER_CONFIG_START %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% if defined CMDER_USER_BIN ( %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% From 4d8655984158880311c88a6592dd0f7893e1e644 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Mon, 8 Jun 2020 21:03:41 -0400 Subject: [PATCH 212/371] Update init.bat Remove cmder_configured goto --- vendor/init.bat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index aa999a9..ab74229 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -51,11 +51,11 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" -if "%CMDER_CONFIGURED%" == "1" ( - echo Cmder is already configured, skipping to user config! - - goto USER_CONFIG_START -) +:: if "%CMDER_CONFIGURED%" == "1" ( +:: echo Cmder is already configured, skipping to user config! +:: +:: goto USER_CONFIG_START +:: ) :var_loop if "%~1" == "" ( From 31c019b7e40d0e505fcec4d53b8c884b2f2fb06c Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Mon, 8 Jun 2020 21:18:23 -0400 Subject: [PATCH 213/371] Update init.bat Move skip to user config below clink enablement in cmder_configured == 1 --- vendor/init.bat | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vendor/init.bat b/vendor/init.bat index ab74229..4043bf3 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -172,6 +172,12 @@ if "%CMDER_CLINK%" == "1" ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" ) +if "%CMDER_CONFIGURED%" == "1" ( + echo Cmder is already configured, skipping to user config! + + goto USER_CONFIG_START +) + :: Prepare for git-for-windows :: I do not even know, copypasted from their .bat From 8781779636a44078db21d34cf85f5ecee5b854f8 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Tue, 9 Jun 2020 19:41:08 -0400 Subject: [PATCH 214/371] Update init.bat If CMDER_CONFIGURED==1 skip to :CMDER_CONFIGURED --- vendor/init.bat | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 4043bf3..a4fecf9 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -51,12 +51,6 @@ call "%cmder_root%\vendor\lib\lib_console" call "%cmder_root%\vendor\lib\lib_git" call "%cmder_root%\vendor\lib\lib_profile" -:: if "%CMDER_CONFIGURED%" == "1" ( -:: echo Cmder is already configured, skipping to user config! -:: -:: goto USER_CONFIG_START -:: ) - :var_loop if "%~1" == "" ( goto :start @@ -173,9 +167,9 @@ if "%CMDER_CLINK%" == "1" ( ) if "%CMDER_CONFIGURED%" == "1" ( - echo Cmder is already configured, skipping to user config! + echo Cmder is already configured, skipping Cmder Init! - goto USER_CONFIG_START + goto CMDER_CONFIGURED ) :: Prepare for git-for-windows @@ -393,6 +387,8 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD ) set initialConfig= + +:CMDER_CONFIGURED set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% From 29aa75e1586903eb74f588076c9490bd6b0b0018 Mon Sep 17 00:00:00 2001 From: Gaizka P <1368043+kvittokonito@users.noreply.github.com> Date: Wed, 24 Jun 2020 02:50:15 +0200 Subject: [PATCH 215/371] Added support for setting custom icons for Cmder window. --- launcher/src/CmderLauncher.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 86ba8f3..1a7e13f 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -71,7 +71,7 @@ bool FileExists(const wchar_t * filePath) return false; } -void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"") +void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring iconPath = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"") { #if USE_TASKBAR_API wchar_t appId[MAX_PATH] = { 0 }; @@ -111,7 +111,15 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathRemoveFileSpec(exeDir); - PathCombine(icoPath, exeDir, L"icons\\cmder.ico"); + if (PathFileExists(iconPath.c_str())) + { + std::copy(iconPath.begin(), iconPath.end(), icoPath); + icoPath[iconPath.length()] = 0; + } + else + { + PathCombine(icoPath, exeDir, L"icons\\cmder.ico"); + } PathCombine(configDirPath, exeDir, L"config"); @@ -532,6 +540,7 @@ struct cmderOptions std::wstring cmderCfgRoot = L""; std::wstring cmderStart = L""; std::wstring cmderTask = L""; + std::wstring cmderIcon = L""; std::wstring cmderRegScope = L"USER"; std::wstring cmderConEmuArgs = L""; bool cmderSingle = false; @@ -593,6 +602,11 @@ cmderOptions GetOption() cmderOptions.cmderTask = szArgList[i + 1]; i++; } + else if (_wcsicmp(L"/icon", szArgList[i]) == 0) + { + cmderOptions.cmderIcon = szArgList[i + 1]; + i++; + } else if (_wcsicmp(L"/single", szArgList[i]) == 0) { cmderOptions.cmderSingle = true; @@ -659,13 +673,13 @@ cmderOptions GetOption() } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter (no start case).\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /icon [CMDER Icon Path]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } else { - MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter (start case).\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /icon [CMDER Icon Path]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } @@ -707,7 +721,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } else { - StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs); + StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderIcon, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs); } return 0; From e9f20aea919e34c79a0204a39b31784681814f58 Mon Sep 17 00:00:00 2001 From: Gaizka P <1368043+kvittokonito@users.noreply.github.com> Date: Wed, 24 Jun 2020 02:52:03 +0200 Subject: [PATCH 216/371] Added build configurations for x64. --- launcher/CmderLauncher.sln | 6 +++ launcher/CmderLauncher.vcxproj | 81 ++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/launcher/CmderLauncher.sln b/launcher/CmderLauncher.sln index 9b4bc65..7cf5ae5 100644 --- a/launcher/CmderLauncher.sln +++ b/launcher/CmderLauncher.sln @@ -9,12 +9,18 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Debug|Win32.ActiveCfg = Debug|Win32 {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Debug|Win32.Build.0 = Debug|Win32 {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Release|Win32.ActiveCfg = Release|Win32 {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Release|Win32.Build.0 = Release|Win32 + {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Debug|x64.ActiveCfg = Debug|x64 + {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Debug|x64.Build.0 = Debug|x64 + {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Release|x64.ActiveCfg = Release|x64 + {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/launcher/CmderLauncher.vcxproj b/launcher/CmderLauncher.vcxproj index 08deaeb..6076523 100644 --- a/launcher/CmderLauncher.vcxproj +++ b/launcher/CmderLauncher.vcxproj @@ -9,6 +9,14 @@ Release Win32 + + Debug + x64 + + + Release + x64 + {4A8485A5-B7DD-4C44-B7F6-3E2765DD0CD3} @@ -30,6 +38,19 @@ Unicode v141 + + Application + true + v141_xp + Unicode + + + Application + false + true + Unicode + v141 + @@ -39,6 +60,12 @@ + + + + + + true @@ -48,6 +75,14 @@ false Cmder + + true + Cmder + + + false + Cmder + @@ -94,6 +129,52 @@ copy $(TargetPath) $(SolutionDir)..\$(TargetFileName) + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + src/app.manifest %(AdditionalManifestFiles) + + + _USING_V110_SDK71_;%(PreprocessorDefinitions) + + + + + Level3 + + + MinSpace + true + false + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + Size + MultiThreaded + + + Windows + true + true + true + + + src/app.manifest %(AdditionalManifestFiles) + + + copy $(TargetPath) $(SolutionDir)..\$(TargetFileName) + + RC From ee25dbaab66d252e6ef0e046ba3216764acbe585 Mon Sep 17 00:00:00 2001 From: Gaizka P <1368043+kvittokonito@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:25:30 +0200 Subject: [PATCH 217/371] Removed leftover debug text in error message box. --- launcher/src/CmderLauncher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 1a7e13f..05d3f99 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -673,13 +673,13 @@ cmderOptions GetOption() } else { - MessageBox(NULL, L"Unrecognized parameter (no start case).\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /icon [CMDER Icon Path]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n /icon [CMDER Icon Path]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } else { - MessageBox(NULL, L"Unrecognized parameter (start case).\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /icon [CMDER Icon Path]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); + MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n /icon [CMDER Icon Path]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); cmderOptions.error = true; } } From 130dc750be987262eec18adfb9218216b28a820e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 26 Jun 2020 16:45:21 -0400 Subject: [PATCH 218/371] CHANGELOG.md --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1593af4..4f2e168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [1.3.15](https://github.com/cmderdev/cmder/tree/v1.3.15) (2020-06-26) + +* Fixes #2247, fixes #2254 [#2265](https://github.com/cmderdev/cmder/pull/2265) +* Clink path get broken if clink-completions content is created in a different order #2278Clink path get broken if clink-completions content is created in a different order [#2278](https://github.com/cmderdev/cmder/pull/2278) +* Move Git functions to `lib/git.bat` [#2293](https://github.com/cmderdev/cmder/pull/2293) +* Fix Cmder issue #2290 [#2294](https://github.com/cmderdev/cmder/pull/2294) +* Update git for windows to 2.26.2 [#2308](https://github.com/cmderdev/cmder/pull/2308) +* Update README.md #2323Update README.md [#2323](https://github.com/cmderdev/cmder/pull/2323) +* Added support for setting custom icons for Cmder window [#2335](https://github.com/cmderdev/cmder/pull/2335) +* Fix and enhance enhance_path_recursive [#2311](https://github.com/cmderdev/cmder/pull/2311) + ## [1.3.14](https://github.com/cmderdev/cmder/tree/v1.3.14) (2020-01-08) ### Fixes From 250ae06e7ab3ecbd7ff2460b2b532bcb420c3982 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 26 Jun 2020 22:27:29 -0400 Subject: [PATCH 219/371] fix vscode terminal errors when setting cmder fast_init=1 outside cmder --- vendor/lib/lib_console.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index 17540dd..2b18d15 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -1,10 +1,10 @@ @echo off -if "%fast_init%" == "1" exit /b - call "%~dp0lib_base.cmd" set lib_console=call "%~dp0lib_console.cmd" +if "%fast_init%" == "1" exit /b + if "%~1" == "/h" ( %lib_base% help "%~0" ) else if "%1" neq "" ( From 52f5ad62c35f6e6aed69d961ec5e56f5e7c54626 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 26 Jun 2020 22:29:26 -0400 Subject: [PATCH 220/371] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f2e168..1a22ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 1.3.16-pre + +* fix vscode terminal errors when setting cmder fast_init=1 outside cmder [#2339](https://github.com/cmderdev/cmder/pull/2339) + ## [1.3.15](https://github.com/cmderdev/cmder/tree/v1.3.15) (2020-06-26) * Fixes #2247, fixes #2254 [#2265](https://github.com/cmderdev/cmder/pull/2265) From da5f1bc4db2966b3523e6778a3d7b8194877ab9b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 29 Jun 2020 07:49:22 -0400 Subject: [PATCH 221/371] fix git detect --- vendor/init.bat | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index a4fecf9..eacad85 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -151,6 +151,7 @@ if "%CMDER_CLINK%" == "1" ( if not exist "%CMDER_USER_CONFIG%\settings" ( echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" + B echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ ) "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" @@ -200,14 +201,14 @@ if defined GIT_INSTALL_ROOT ( :: check if git is in path... for /F "delims=" %%F in ('where git.exe 2^>nul') do ( - :: get the absolute path to the user provided git binary - %lib_git% is_git_shim "%%~dpF" - %lib_git% get_user_git_version - %lib_git% compare_git_versions -) + if not defined GIT_INSTALL_ROOT ( + :: get the absolute path to the user provided git binary + %lib_git% is_git_shim "%%~dpF" + %lib_git% get_user_git_version + %lib_git% compare_git_versions -if defined GIT_INSTALL_ROOT ( - goto :FOUND_GIT + goto :FOUND_GIT + ) ) :: our last hope: our own git... From 4403edb110a169048acf5ea21259da05c7a0557e Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Wed, 1 Jul 2020 08:26:44 -0400 Subject: [PATCH 222/371] Update init.bat --- vendor/init.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index eacad85..f34560e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -207,7 +207,9 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( %lib_git% get_user_git_version %lib_git% compare_git_versions - goto :FOUND_GIT + if defined GIT_INSTALL_ROOT ( + goto :FOUND_GIT + ) ) ) From c332ab1a34304c92212f0cb4b888f84f544d2570 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 1 Jul 2020 16:24:36 -0400 Subject: [PATCH 223/371] Fix bug introduced in 1.3.15 --- vendor/init.bat | 10 +++++++--- vendor/profile.ps1 | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index f34560e..9c43b65 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -167,10 +167,14 @@ if "%CMDER_CLINK%" == "1" ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" ) -if "%CMDER_CONFIGURED%" == "1" ( +if "%CMDER_CONFIGURED%" == "2" ( echo Cmder is already configured, skipping Cmder Init! goto CMDER_CONFIGURED +) else if "%CMDER_CONFIGURED%" == "1" ( + echo Cmder is already configured, skipping to Cmder User Init! + + goto USER_CONFIG_START ) :: Prepare for git-for-windows @@ -236,10 +240,10 @@ goto :CONFIGURE_GIT :: Add git to the path rem add the unix commands at the end to not shadow windows commands like more if %nix_tools% equ 1 ( - %lib_console% debug_output init.bat "Preferring Windows commands" + %lib_console% verbose_output "Preferring Windows commands" set "path_position=append" ) else ( - %lib_console% debug_output init.bat "Preferring *nix commands" + %lib_console% verbose_output "Preferring *nix commands" set "path_position=" ) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index ad9182a..5b940fd 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -1,4 +1,4 @@ -# Init Script for PowerShell +# Init Script for PowerShell # Created as part of cmder project # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED From 0f12de345b35a6a8a77249ce388f973a89fa0350 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 2 Jul 2020 07:00:25 -0400 Subject: [PATCH 224/371] Update init.bat --- vendor/init.bat | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 9c43b65..d6eb099 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -151,7 +151,6 @@ if "%CMDER_CLINK%" == "1" ( if not exist "%CMDER_USER_CONFIG%\settings" ( echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" - B echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ ) "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" @@ -168,11 +167,11 @@ if "%CMDER_CLINK%" == "1" ( ) if "%CMDER_CONFIGURED%" == "2" ( - echo Cmder is already configured, skipping Cmder Init! + %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" goto CMDER_CONFIGURED ) else if "%CMDER_CONFIGURED%" == "1" ( - echo Cmder is already configured, skipping to Cmder User Init! + %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!" goto USER_CONFIG_START ) @@ -205,15 +204,13 @@ if defined GIT_INSTALL_ROOT ( :: check if git is in path... for /F "delims=" %%F in ('where git.exe 2^>nul') do ( - if not defined GIT_INSTALL_ROOT ( - :: get the absolute path to the user provided git binary - %lib_git% is_git_shim "%%~dpF" - %lib_git% get_user_git_version - %lib_git% compare_git_versions + :: get the absolute path to the user provided git binary + %lib_git% is_git_shim "%%~dpF" + %lib_git% get_user_git_version + %lib_git% compare_git_versions - if defined GIT_INSTALL_ROOT ( - goto :FOUND_GIT - ) + if defined GIT_INSTALL_ROOT ( + goto :FOUND_GIT ) ) From f1c1354c007c7018cd31493e0a18dc602b694bb5 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 4 Jul 2020 13:43:18 -0400 Subject: [PATCH 225/371] make vscode_init.cmd smart enough to apply cmder settings if launched from inside or outside cmder --- vendor/bin/vscode_init.cmd | 27 ++++++++++++ vendor/bin/vscode_init_args.cmd.default | 58 +++++++++++++++++++++++++ vendor/init.bat | 9 +++- 3 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 vendor/bin/vscode_init_args.cmd.default diff --git a/vendor/bin/vscode_init.cmd b/vendor/bin/vscode_init.cmd index f95dc66..cc1161b 100644 --- a/vendor/bin/vscode_init.cmd +++ b/vendor/bin/vscode_init.cmd @@ -1,4 +1,31 @@ @echo off + +:: Find root dir + +if not defined CMDER_ROOT ( + for /f "delims=" %%i in ("%~dp0\..\..") do ( + set "cmder_root=%%~fi" + ) +) + +if defined cmder_user_bin ( + if exist "%cmder_user_bin%\vscode_init_args.cmd" ( + set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd + ) else ( + echo Creating initial "%CMDER_ROOT%\bin\vscode_init_args.cmd"... + copy "%CMDER_ROOT%\bin\vscode_init_args.cmd.default" "%cmder_user_bin%\vscode_init_args.cmd" + ) +) else if exist "%CMDER_ROOT%\bin\vscode_init_args.cmd" ( + set CMDER_VSCODE_INIT_ARGS=%CMDER_ROOT%\bin\vscode_init_args.cmd +) else ( + echo Creating initial "%CMDER_ROOT%\bin\vscode_init_args.cmd"... + copy "%CMDER_ROOT%\bin\vscode_init_args.cmd.default" "%CMDER_ROOT%\bin\vscode_init_args.cmd" +) + +if defined CMDER_VSCODE_INIT_ARGS ( + call "%CMDER_VSCODE_INIT_ARGS%" +) + IF [%1] == [] ( REM -- manually opened console (Ctrl + Shift + `) -- CALL "%~dp0..\init.bat" diff --git a/vendor/bin/vscode_init_args.cmd.default b/vendor/bin/vscode_init_args.cmd.default new file mode 100644 index 0000000..687e24a --- /dev/null +++ b/vendor/bin/vscode_init_args.cmd.default @@ -0,0 +1,58 @@ +@echo off + +:: Below are the default Cmder session settings: +:: +:: See "%CMDER_ROOT%\README.md" for details on these settings. +:: +:: `Cmder.exe` Arguments: +:: ---------------------- +:: +:: `/c [cmder_user_cfg_root] +:: set cmder_user_bin=[cmder_user_cfg_root]\bin +:: set cmder_user_config=[cmder_user_cfg_root]\config +:: +:: `init.bat` Arguments +:: -------------------- +:: +:: `/d` +:: debug_output=0 +:: +:: `/v` +:: verbose_output=0 +:: +:: `/f` +:: fast_init=0 +:: +:: `/nix_tools` +:: nix_tools=1 +:: +:: `/t` +:: time_init=0 +:: +:: `/max_depth` +:: max_depth=1 +:: +:: `/user_aliases` +:: user_aliases= +:: +:: `/git_install_root` +:: GIT_INSTALL_ROOT= +:: +:: `/home` +:: HOME= +:: +:: `/svn_ssh` +:: SVN_SSH= + +echo Applying Cmder VSCode settings from '%~0'... + +if defined CMDER_CONFIGURED ( + :: Set Cmder settings here for when VSCode is launched inside Cmder. + set verbose_output=1 +) else ( + :: Set Cmder settings here for when VSCode is launched from outside Cmder. + set verbose_output=1 +) + +:: Set all required Cmder VSCode terminal environment settings above this line. +echo Applying Cmder VSCode settings is complete! \ No newline at end of file diff --git a/vendor/init.bat b/vendor/init.bat index d6eb099..88d0fd2 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -166,10 +166,10 @@ if "%CMDER_CLINK%" == "1" ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" ) -if "%CMDER_CONFIGURED%" == "2" ( +if "%CMDER_CONFIGURED%" gtr 1 ( %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" - goto CMDER_CONFIGURED + goto USER_ALIASES ) else if "%CMDER_CONFIGURED%" == "1" ( %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!" @@ -298,6 +298,7 @@ if defined CMDER_USER_CONFIG ( %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" ) +:USER_ALIASES :: Allows user to override default aliases store using profile.d :: scripts run above by setting the 'aliases' env variable. :: @@ -342,7 +343,11 @@ if "%CMDER_ALIASES%" == "1" ( :: Add aliases to the environment call "%user_aliases%" +if "%CMDER_CONFIGURED%" gtr 1 goto CMDER_CONFIGURED + :: See vendor\git-for-windows\README.portable for why we do this +:: A +:: A :: Basically we need to execute this post-install.bat because we are :: manually extracting the archive rather than executing the 7z sfx if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( From 5e7a7029d138f6a1cefbeae6e3d98e9b58c3053e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 4 Jul 2020 14:23:16 -0400 Subject: [PATCH 226/371] make vscode_init.cmd smart enough to apply cmder settings if launched from inside or outside cmder --- vendor/bin/vscode_init.cmd | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vendor/bin/vscode_init.cmd b/vendor/bin/vscode_init.cmd index cc1161b..fc6b300 100644 --- a/vendor/bin/vscode_init.cmd +++ b/vendor/bin/vscode_init.cmd @@ -11,18 +11,15 @@ if not defined CMDER_ROOT ( if defined cmder_user_bin ( if exist "%cmder_user_bin%\vscode_init_args.cmd" ( set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd - ) else ( - echo Creating initial "%CMDER_ROOT%\bin\vscode_init_args.cmd"... - copy "%CMDER_ROOT%\bin\vscode_init_args.cmd.default" "%cmder_user_bin%\vscode_init_args.cmd" ) ) else if exist "%CMDER_ROOT%\bin\vscode_init_args.cmd" ( set CMDER_VSCODE_INIT_ARGS=%CMDER_ROOT%\bin\vscode_init_args.cmd -) else ( - echo Creating initial "%CMDER_ROOT%\bin\vscode_init_args.cmd"... - copy "%CMDER_ROOT%\bin\vscode_init_args.cmd.default" "%CMDER_ROOT%\bin\vscode_init_args.cmd" ) -if defined CMDER_VSCODE_INIT_ARGS ( +if not exist "%CMDER_VSCODE_INIT_ARGS%" ( + echo Creating initial "%CMDER_VSCODE_INIT_ARGS%"... + copy "%CMDER_ROOT%\vendor\bin\vscode_init_args.cmd.default" "%CMDER_VSCODE_INIT_ARGS%" +else ( call "%CMDER_VSCODE_INIT_ARGS%" ) From 2c620d1d6726e6072487ea9f6a406a1be934e4b8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Jul 2020 15:13:23 -0400 Subject: [PATCH 227/371] cleanup --- vendor/bin/vscode_init_args.cmd.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/bin/vscode_init_args.cmd.default b/vendor/bin/vscode_init_args.cmd.default index 687e24a..8ee8f89 100644 --- a/vendor/bin/vscode_init_args.cmd.default +++ b/vendor/bin/vscode_init_args.cmd.default @@ -55,4 +55,4 @@ if defined CMDER_CONFIGURED ( ) :: Set all required Cmder VSCode terminal environment settings above this line. -echo Applying Cmder VSCode settings is complete! \ No newline at end of file +echo Applying Cmder VSCode settings is complete! From 954937cf979acc442aa4f27bc0915ff4edb0b7fe Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 5 Jul 2020 15:22:09 -0400 Subject: [PATCH 228/371] cleanup --- vendor/bin/vscode_init.cmd | 8 ++--- vscode_init_args.cmd | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 vscode_init_args.cmd diff --git a/vendor/bin/vscode_init.cmd b/vendor/bin/vscode_init.cmd index fc6b300..bbe1ba2 100644 --- a/vendor/bin/vscode_init.cmd +++ b/vendor/bin/vscode_init.cmd @@ -9,17 +9,15 @@ if not defined CMDER_ROOT ( ) if defined cmder_user_bin ( - if exist "%cmder_user_bin%\vscode_init_args.cmd" ( - set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd - ) -) else if exist "%CMDER_ROOT%\bin\vscode_init_args.cmd" ( + set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd +) else ( set CMDER_VSCODE_INIT_ARGS=%CMDER_ROOT%\bin\vscode_init_args.cmd ) if not exist "%CMDER_VSCODE_INIT_ARGS%" ( echo Creating initial "%CMDER_VSCODE_INIT_ARGS%"... copy "%CMDER_ROOT%\vendor\bin\vscode_init_args.cmd.default" "%CMDER_VSCODE_INIT_ARGS%" -else ( +) else ( call "%CMDER_VSCODE_INIT_ARGS%" ) diff --git a/vscode_init_args.cmd b/vscode_init_args.cmd new file mode 100644 index 0000000..87b4071 --- /dev/null +++ b/vscode_init_args.cmd @@ -0,0 +1,64 @@ +@echo off + +:: Below are the default Cmder session settings: +:: +:: See "%CMDER_ROOT%\README.md" for details on these settings. +:: +:: `Cmder.exe` Arguments: +:: ---------------------- +:: +:: `/c [cmder_user_cfg_root]` +:: NOT USED BY DEFAULT +:: cmder_user_bin=[cmder_user_cfg_root]\bin +:: cmder_user_config=[cmder_user_cfg_root]\config +:: +:: `init.bat` Arguments +:: -------------------- +:: +:: `/d` +:: debug_output=0 +:: +:: `/v` +:: verbose_output=0 +:: +:: `/f` +:: fast_init=0 +:: +:: `/nix_tools` +:: nix_tools=1 +:: +:: `/t` +:: time_init=0 +:: +:: `/max_depth` +:: max_depth=1 +:: +:: `/user_aliases` +:: user_aliases= +:: +:: `/git_install_root` +:: GIT_INSTALL_ROOT= +:: +:: `/home` +:: HOME= +:: +:: `/svn_ssh` +:: SVN_SSH= + +echo Applying Cmder VSCode settings from '%~0'... + +if defined CMDER_CONFIGURED ( + :: Set Cmder settings here for when VSCode is launched inside Cmder. + set CMDER_CONFIGURED=2 +) else ( + :: Set Cmder settings here for when VSCode is launched from outside Cmder. + set nix_tools=0 + set fast_init=1 + set cmder_user_bin=c:\users\dtgam\cmder\bin + set cmder_user_config=c:\users\dtgam\cmder\config +) + +set verbose_output=1 + +:: Set all required Cmder VSCode terminal environment settings above this line. +echo Applying Cmder VSCode settings is complete! From 97a41ddd995fa0a2db402a26ed1badc21afae9fb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Tue, 14 Jul 2020 22:31:57 -0400 Subject: [PATCH 229/371] fix cmder_configured GTR 1 --- vendor/init.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 88d0fd2..fea177e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -166,7 +166,7 @@ if "%CMDER_CLINK%" == "1" ( %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" ) -if "%CMDER_CONFIGURED%" gtr 1 ( +if "%CMDER_CONFIGURED%" GTR "1" ( %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" goto USER_ALIASES @@ -343,7 +343,7 @@ if "%CMDER_ALIASES%" == "1" ( :: Add aliases to the environment call "%user_aliases%" -if "%CMDER_CONFIGURED%" gtr 1 goto CMDER_CONFIGURED +if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED :: See vendor\git-for-windows\README.portable for why we do this :: A @@ -398,7 +398,7 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD set initialConfig= :CMDER_CONFIGURED -set CMDER_CONFIGURED=1 +if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% From 40c58417b2aea2293fd5675835005b34008605b0 Mon Sep 17 00:00:00 2001 From: famoses Date: Sat, 18 Jul 2020 13:32:22 +0200 Subject: [PATCH 230/371] quote time measures for timer.cmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The startup time duration is calculated wrongly ( at least for me, on Windows 1909, with CmderMini 1.3.15.1010 ). I got something like "Elapsed Time: 80:36:1.00 (290161.00s total)" printed into the cmder consle window. I can be solved by quoting the time measures taken in `init.bat`. It seems that `time.cmd` fails in recognizing two arguments. In fact it did split the first time measure into two arguments and ignored the second time measure. Example: from the two time measures λ echo %CMDER_INIT_START% %CMDER_INIT_END% 12:53:44,34 12:53:54,04 The call to `time.cmd` created following output (i added echo commands to print variables start and end right after they got assigned the arguments) start: 12:53:44 end: 34 --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index a4fecf9..43683fc 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -394,6 +394,6 @@ set CMDER_CONFIGURED=1 set CMDER_INIT_END=%time% if %time_init% gtr 0 ( - "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% + "%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%" ) exit /b From fdcbd6df87752910f1945f1e03f469b6abe07014 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 23 Jul 2020 08:43:09 -0400 Subject: [PATCH 231/371] Delete vscode_init_args.cmd --- vscode_init_args.cmd | 64 -------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 vscode_init_args.cmd diff --git a/vscode_init_args.cmd b/vscode_init_args.cmd deleted file mode 100644 index 87b4071..0000000 --- a/vscode_init_args.cmd +++ /dev/null @@ -1,64 +0,0 @@ -@echo off - -:: Below are the default Cmder session settings: -:: -:: See "%CMDER_ROOT%\README.md" for details on these settings. -:: -:: `Cmder.exe` Arguments: -:: ---------------------- -:: -:: `/c [cmder_user_cfg_root]` -:: NOT USED BY DEFAULT -:: cmder_user_bin=[cmder_user_cfg_root]\bin -:: cmder_user_config=[cmder_user_cfg_root]\config -:: -:: `init.bat` Arguments -:: -------------------- -:: -:: `/d` -:: debug_output=0 -:: -:: `/v` -:: verbose_output=0 -:: -:: `/f` -:: fast_init=0 -:: -:: `/nix_tools` -:: nix_tools=1 -:: -:: `/t` -:: time_init=0 -:: -:: `/max_depth` -:: max_depth=1 -:: -:: `/user_aliases` -:: user_aliases= -:: -:: `/git_install_root` -:: GIT_INSTALL_ROOT= -:: -:: `/home` -:: HOME= -:: -:: `/svn_ssh` -:: SVN_SSH= - -echo Applying Cmder VSCode settings from '%~0'... - -if defined CMDER_CONFIGURED ( - :: Set Cmder settings here for when VSCode is launched inside Cmder. - set CMDER_CONFIGURED=2 -) else ( - :: Set Cmder settings here for when VSCode is launched from outside Cmder. - set nix_tools=0 - set fast_init=1 - set cmder_user_bin=c:\users\dtgam\cmder\bin - set cmder_user_config=c:\users\dtgam\cmder\config -) - -set verbose_output=1 - -:: Set all required Cmder VSCode terminal environment settings above this line. -echo Applying Cmder VSCode settings is complete! From 7326a3cfc5665de9edb5326943a74df61865528a Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 23 Jul 2020 13:34:13 -0400 Subject: [PATCH 232/371] Update init.bat --- vendor/init.bat | 409 +----------------------------------------------- 1 file changed, 1 insertion(+), 408 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index fea177e..9cc4009 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -1,408 +1 @@ -@echo off - -set CMDER_INIT_START=%time% - -:: Init Script for cmd.exe -:: Created as part of cmder project - -:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED -:: !!! 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. -if not defined verbose_output set verbose_output=0 - -:: Use /d command line arg or set to 1 for debug output to aid in debugging. -if not defined debug_output set debug_output=0 - -:: Use /t command line arg or set to 1 to display init time. -if not defined time_init set time_init=0 - -:: Use /f command line arg to speed up init at the expense of some functionality. -if not defined fast_init set fast_init=0 - -:: Use /max_depth 1-5 to set max recurse depth for calls to `enhance_path_recursive` -if not defined max_depth set max_depth=1 - -:: Add *nix tools to end of path. 0 turns off *nix tools, 2 adds *nix tools to the front of thr path. -if not defined nix_tools set nix_tools=1 - -set "CMDER_USER_FLAGS= " - -:: Find root dir -if not defined CMDER_ROOT ( - if defined ConEmuDir ( - for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( - set "CMDER_ROOT=%%~fi" - ) - ) else ( - for /f "delims=" %%i in ("%~dp0\..") do ( - set "CMDER_ROOT=%%~fi" - ) - ) -) - -:: Remove trailing '\' from %CMDER_ROOT% -if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%" - -call "%cmder_root%\vendor\bin\cexec.cmd" /setpath -call "%cmder_root%\vendor\lib\lib_base" -call "%cmder_root%\vendor\lib\lib_path" -call "%cmder_root%\vendor\lib\lib_console" -call "%cmder_root%\vendor\lib\lib_git" -call "%cmder_root%\vendor\lib\lib_profile" - -:var_loop - if "%~1" == "" ( - goto :start - ) 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 - ) else if /i "%1"=="/d" ( - set debug_output=1 - ) else if /i "%1" == "/max_depth" ( - if "%~2" geq "1" if "%~2" leq "5" ( - set "max_depth=%~2" - shift - ) else ( - %lib_console% show_error "'/max_depth' requires a number between 1 and 5!" - exit /b - ) - ) else if /i "%1" == "/c" ( - if exist "%~2" ( - if not exist "%~2\bin" mkdir "%~2\bin" - set "cmder_user_bin=%~2\bin" - if not exist "%~2\config\profile.d" mkdir "%~2\config\profile.d" - set "cmder_user_config=%~2\config" - shift - ) - ) else if /i "%1" == "/user_aliases" ( - if exist "%~2" ( - set "user_aliases=%~2" - shift - ) - ) else if /i "%1" == "/git_install_root" ( - if exist "%~2" ( - set "GIT_INSTALL_ROOT=%~2" - shift - ) else ( - %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" - 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" ( - if exist "%~2" ( - set "HOME=%~2" - shift - ) else ( - %lib_console% show_error The home folder "%2", you specified does not exist! - exit /b - ) - ) else if /i "%1" == "/svn_ssh" ( - set SVN_SSH=%2 - shift - ) else ( - set "CMDER_USER_FLAGS=%1 %CMDER_USER_FLAGS%" - ) - shift -goto var_loop - -:start -:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES -%lib_base% cmder_shell -%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" -%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" - -if defined CMDER_USER_CONFIG ( - %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" - - if not exist "%CMDER_USER_CONFIG%\opt" md "%CMDER_USER_CONFIG%\opt" -) - -:: Pick right version of clink -if "%PROCESSOR_ARCHITECTURE%"=="x86" ( - set clink_architecture=x86 - set architecture_bits=32 -) else ( - set clink_architecture=x64 - set architecture_bits=64 -) - -if "%CMDER_CLINK%" == "1" ( - %lib_console% verbose_output "Injecting Clink!" - - :: Run clink - if defined CMDER_USER_CONFIG ( - if not exist "%CMDER_USER_CONFIG%\settings" ( - echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" - copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" - echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ - ) - "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" - ) else ( - if not exist "%CMDER_ROOT%\config\settings" ( - echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" - copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" - echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. - ) - "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" - ) -) else ( - %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" -) - -if "%CMDER_CONFIGURED%" GTR "1" ( - %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" - - goto USER_ALIASES -) else if "%CMDER_CONFIGURED%" == "1" ( - %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!" - - goto USER_CONFIG_START -) - -:: Prepare for git-for-windows - -:: I do not even know, copypasted from their .bat -set PLINK_PROTOCOL=ssh -if not defined TERM set TERM=cygwin - -:: The idea: -:: * if the users points as to a specific git, use that -:: * test if a git is in path and if yes, use that -:: * last, use our vendored git -:: also check that we have a recent enough version of git by examining the version string -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..." - -:: 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% - -:: check if git is in path... -for /F "delims=" %%F in ('where git.exe 2^>nul') do ( - :: get the absolute path to the user provided git binary - %lib_git% is_git_shim "%%~dpF" - %lib_git% get_user_git_version - %lib_git% compare_git_versions - - if defined GIT_INSTALL_ROOT ( - goto :FOUND_GIT - ) -) - -:: our last hope: our own git... -: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 '%GIT_VERSION_VENDORED%'..." - goto :CONFIGURE_GIT -) else ( - goto :NO_GIT -) - -:SPECIFIED_GIT -%lib_console% debug_output "Using /GIT_INSTALL_ROOT..." -goto :CONFIGURE_GIT - -:FOUND_GIT -%lib_console% debug_output "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." -goto :CONFIGURE_GIT - -:CONFIGURE_GIT -%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." -:: Add git to the path -rem add the unix commands at the end to not shadow windows commands like more -if %nix_tools% equ 1 ( - %lib_console% verbose_output "Preferring Windows commands" - set "path_position=append" -) else ( - %lib_console% verbose_output "Preferring *nix commands" - set "path_position=" -) - -if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position% -if %nix_tools% geq 1 ( - if exist "%GIT_INSTALL_ROOT%\mingw32" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% - ) 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%\usr\bin" %path_position% -) - -:: 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" - -:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. -if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe" -if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" ) -if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale -if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" /usr/bin/locale ) - -if defined git_locale ( - %lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" - if not defined LANG ( - for /F "delims=" %%F in ('%git_locale% -uU 2') do ( - set "LANG=%%F" - ) - ) -) - -%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" -goto :PATH_ENHANCE - -:NO_GIT -:: Skip this if GIT WAS FOUND else we did 'endlocal' above! -endlocal - -:PATH_ENHANCE -%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" - -:USER_CONFIG_START -%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% -if defined CMDER_USER_BIN ( - %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% -) -%lib_path% enhance_path "%CMDER_ROOT%" append - -:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" -:: to run them at startup. -%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" -if defined CMDER_USER_CONFIG ( - %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" -) - -:USER_ALIASES -:: Allows user to override default aliases store using profile.d -:: scripts run above by setting the 'aliases' env variable. -:: -:: Note: If overriding default aliases store file the aliases -:: must also be self executing, see '.\user_aliases.cmd.default', -:: and be in profile.d folder. -if not defined user_aliases ( - if defined CMDER_USER_CONFIG ( - set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd" - ) else ( - set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd" - ) -) - -if "%CMDER_ALIASES%" == "1" ( - REM The aliases environment variable is used by alias.bat to id - REM the default file to store new aliases in. - if not defined aliases ( - set "aliases=%user_aliases%" - ) - - REM Make sure we have a self-extracting user_aliases.cmd file - if not exist "%user_aliases%" ( - echo Creating initial user_aliases store in "%user_aliases%"... - copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" - ) else ( - %lib_base% update_legacy_aliases - ) - - :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' - if exist "%CMDER_ROOT%\config\aliases" ( - echo Updating old "%CMDER_ROOT%\config\aliases" to new format... - type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" - del "%CMDER_ROOT%\config\aliases" - ) else if exist "%user_aliases%.old_format" ( - echo Updating old "%user_aliases%" to new format... - type "%user_aliases%.old_format" >> "%user_aliases%" - del "%user_aliases%.old_format" - ) -) - -:: Add aliases to the environment -call "%user_aliases%" - -if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED - -:: See vendor\git-for-windows\README.portable for why we do this -:: A -:: A -:: Basically we need to execute this post-install.bat because we are -:: manually extracting the archive rather than executing the 7z sfx -if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( - echo Running Git for Windows one time Post Install.... - pushd "%GIT_INSTALL_ROOT%\" - "%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat - popd -) - -:: Set home path -if not defined HOME set "HOME=%USERPROFILE%" -%lib_console% debug_output init.bat "Env Var - HOME=%HOME%" - -set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" -if exist "%CMDER_ROOT%\config\user_profile.cmd" ( - REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd" - call "%CMDER_ROOT%\config\user_profile.cmd" -) - -if defined CMDER_USER_CONFIG ( - set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" - if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( - REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd - call "%CMDER_USER_CONFIG%\user_profile.cmd" - ) -) - -if not exist "%initialConfig%" ( - echo Creating user startup file: "%initialConfig%" - copy "%CMDER_ROOT%\vendor\user_profile.cmd.default" "%initialConfig%" -) - -if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( - echo Cmder's 'alias' command has been moved into "%CMDER_ROOT%\vendor\bin\alias.cmd" - echo to get rid of this message either: - echo. - echo Delete the file "%CMDER_ROOT%\bin\alias.bat" - echo. - echo or - echo. - echo If you have customized it and want to continue using it instead of the included version - echo * Rename "%CMDER_ROOT%\bin\alias.bat" to "%CMDER_ROOT%\bin\alias.cmd". - echo * Search for 'user-aliases' and replace it with 'user_aliases'. -) - -set initialConfig= - -:CMDER_CONFIGURED -if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 - -set CMDER_INIT_END=%time% - -if %time_init% gtr 0 ( - "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% -) -exit /b +dtgames@kinggeek.org From 79261d4d27baa26f13be16343f995e55ecbf550c Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 23 Jul 2020 13:36:50 -0400 Subject: [PATCH 233/371] fix --- vendor/lib/lib_path.cmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index a8fe253..55d28cb 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -168,7 +168,8 @@ exit /b set "position=" ) - dir "%add_path%" | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL + dir "%add_path%" >NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL + if "%ERRORLEVEL%" == "0" ( set "add_to_path=%add_path%" ) else ( From 0c3d89925e61592aab60cf0f1e556c93dff3902f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 23 Jul 2020 13:41:10 -0400 Subject: [PATCH 234/371] 'fix --- vendor/init.bat | 407 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 406 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 9cc4009..bcc0560 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -1 +1,406 @@ -dtgames@kinggeek.org +@echo off + +set CMDER_INIT_START=%time% + +:: Init Script for cmd.exe +:: Created as part of cmder project + +:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED +:: !!! 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. +if not defined verbose_output set verbose_output=0 + +:: Use /d command line arg or set to 1 for debug output to aid in debugging. +if not defined debug_output set debug_output=0 + +:: Use /t command line arg or set to 1 to display init time. +if not defined time_init set time_init=0 + +:: Use /f command line arg to speed up init at the expense of some functionality. +if not defined fast_init set fast_init=0 + +:: Use /max_depth 1-5 to set max recurse depth for calls to `enhance_path_recursive` +if not defined max_depth set max_depth=1 + +:: Add *nix tools to end of path. 0 turns off *nix tools, 2 adds *nix tools to the front of thr path. +if not defined nix_tools set nix_tools=1 + +set "CMDER_USER_FLAGS= " + +:: Find root dir +if not defined CMDER_ROOT ( + if defined ConEmuDir ( + for /f "delims=" %%i in ("%ConEmuDir%\..\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) else ( + for /f "delims=" %%i in ("%~dp0\..") do ( + set "CMDER_ROOT=%%~fi" + ) + ) +) + +:: Remove trailing '\' from %CMDER_ROOT% +if "%CMDER_ROOT:~-1%" == "\" SET "CMDER_ROOT=%CMDER_ROOT:~0,-1%" + +call "%cmder_root%\vendor\bin\cexec.cmd" /setpath +call "%cmder_root%\vendor\lib\lib_base" +call "%cmder_root%\vendor\lib\lib_path" +call "%cmder_root%\vendor\lib\lib_console" +call "%cmder_root%\vendor\lib\lib_git" +call "%cmder_root%\vendor\lib\lib_profile" + +:var_loop + if "%~1" == "" ( + goto :start + ) 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 + ) else if /i "%1"=="/d" ( + set debug_output=1 + ) else if /i "%1" == "/max_depth" ( + if "%~2" geq "1" if "%~2" leq "5" ( + set "max_depth=%~2" + shift + ) else ( + %lib_console% show_error "'/max_depth' requires a number between 1 and 5!" + exit /b + ) + ) else if /i "%1" == "/c" ( + if exist "%~2" ( + if not exist "%~2\bin" mkdir "%~2\bin" + set "cmder_user_bin=%~2\bin" + if not exist "%~2\config\profile.d" mkdir "%~2\config\profile.d" + set "cmder_user_config=%~2\config" + shift + ) + ) else if /i "%1" == "/user_aliases" ( + if exist "%~2" ( + set "user_aliases=%~2" + shift + ) + ) else if /i "%1" == "/git_install_root" ( + if exist "%~2" ( + set "GIT_INSTALL_ROOT=%~2" + shift + ) else ( + %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" + 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" ( + if exist "%~2" ( + set "HOME=%~2" + shift + ) else ( + %lib_console% show_error The home folder "%2", you specified does not exist! + exit /b + ) + ) else if /i "%1" == "/svn_ssh" ( + set SVN_SSH=%2 + shift + ) else ( + set "CMDER_USER_FLAGS=%1 %CMDER_USER_FLAGS%" + ) + shift +goto var_loop + +:start +:: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES +%lib_base% cmder_shell +%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" +%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" + +if defined CMDER_USER_CONFIG ( + %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" + + if not exist "%CMDER_USER_CONFIG%\opt" md "%CMDER_USER_CONFIG%\opt" +) + +:: Pick right version of clink +if "%PROCESSOR_ARCHITECTURE%"=="x86" ( + set clink_architecture=x86 + set architecture_bits=32 +) else ( + set clink_architecture=x64 + set architecture_bits=64 +) + +if "%CMDER_CLINK%" == "1" ( + %lib_console% verbose_output "Injecting Clink!" + + :: Run clink + if defined CMDER_USER_CONFIG ( + if not exist "%CMDER_USER_CONFIG%\settings" ( + echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" + echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ + ) + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" + ) else ( + if not exist "%CMDER_ROOT%\config\settings" ( + echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" + echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. + ) + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" + ) +) else ( + %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" +) + +if "%CMDER_CONFIGURED%" GTR "1" ( + %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" + + goto USER_ALIASES +) else if "%CMDER_CONFIGURED%" == "1" ( + %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!" + + goto USER_CONFIG_START +) + +:: Prepare for git-for-windows + +:: I do not even know, copypasted from their .bat +set PLINK_PROTOCOL=ssh +if not defined TERM set TERM=cygwin + +:: The idea: +:: * if the users points as to a specific git, use that +:: * test if a git is in path and if yes, use that +:: * last, use our vendored git +:: also check that we have a recent enough version of git by examining the version string +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..." + +:: 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% + +:: check if git is in path... +for /F "delims=" %%F in ('where git.exe 2^>nul') do ( + :: get the absolute path to the user provided git binary + %lib_git% is_git_shim "%%~dpF" + %lib_git% get_user_git_version + %lib_git% compare_git_versions + + if defined GIT_INSTALL_ROOT ( + goto :FOUND_GIT + ) +) + +:: our last hope: our own git... +: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 '%GIT_VERSION_VENDORED%'..." + goto :CONFIGURE_GIT +) else ( + goto :NO_GIT +) + +:SPECIFIED_GIT +%lib_console% debug_output "Using /GIT_INSTALL_ROOT..." +goto :CONFIGURE_GIT + +:FOUND_GIT +%lib_console% debug_output "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." +goto :CONFIGURE_GIT + +:CONFIGURE_GIT +%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." +:: Add git to the path +rem add the unix commands at the end to not shadow windows commands like more +if %nix_tools% equ 1 ( + %lib_console% verbose_output "Preferring Windows commands" + set "path_position=append" +) else ( + %lib_console% verbose_output "Preferring *nix commands" + set "path_position=" +) + +if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position% +if %nix_tools% geq 1 ( + if exist "%GIT_INSTALL_ROOT%\mingw32" ( + %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% + ) 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%\usr\bin" %path_position% +) + +:: 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" + +:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path. +if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe" +if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" ) +if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale +if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" /usr/bin/locale ) + +if defined git_locale ( + %lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" + if not defined LANG ( + for /F "delims=" %%F in ('%git_locale% -uU 2') do ( + set "LANG=%%F" + ) + ) +) + +%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" +%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" +goto :PATH_ENHANCE + +:NO_GIT +:: Skip this if GIT WAS FOUND else we did 'endlocal' above! +endlocal + +:PATH_ENHANCE +%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin" + +:USER_CONFIG_START +%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" 0 %max_depth% +if defined CMDER_USER_BIN ( + %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" 0 %max_depth% +) +%lib_path% enhance_path "%CMDER_ROOT%" append + +:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d" +:: to run them at startup. +%lib_profile% run_profile_d "%CMDER_ROOT%\config\profile.d" +if defined CMDER_USER_CONFIG ( + %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" +) + +:USER_ALIASES +:: Allows user to override default aliases store using profile.d +:: scripts run above by setting the 'aliases' env variable. +:: +:: Note: If overriding default aliases store file the aliases +:: must also be self executing, see '.\user_aliases.cmd.default', +:: and be in profile.d folder. +if not defined user_aliases ( + if defined CMDER_USER_CONFIG ( + set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd" + ) else ( + set "user_aliases=%CMDER_ROOT%\config\user_aliases.cmd" + ) +) + +if "%CMDER_ALIASES%" == "1" ( + REM The aliases environment variable is used by alias.bat to id + REM the default file to store new aliases in. + if not defined aliases ( + set "aliases=%user_aliases%" + ) + + REM Make sure we have a self-extracting user_aliases.cmd file + if not exist "%user_aliases%" ( + echo Creating initial user_aliases store in "%user_aliases%"... + copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%" + ) else ( + %lib_base% update_legacy_aliases + ) + + :: Update old 'user_aliases' to new self executing 'user_aliases.cmd' + if exist "%CMDER_ROOT%\config\aliases" ( + echo Updating old "%CMDER_ROOT%\config\aliases" to new format... + type "%CMDER_ROOT%\config\aliases" >> "%user_aliases%" + del "%CMDER_ROOT%\config\aliases" + ) else if exist "%user_aliases%.old_format" ( + echo Updating old "%user_aliases%" to new format... + type "%user_aliases%.old_format" >> "%user_aliases%" + del "%user_aliases%.old_format" + ) +) + +:: Add aliases to the environment +call "%user_aliases%" + +if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED + +:: See vendor\git-for-windows\README.portable for why we do this +:: Basically we need to execute this post-install.bat because we are +:: manually extracting the archive rather than executing the 7z sfx +if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( + echo Running Git for Windows one time Post Install.... + pushd "%GIT_INSTALL_ROOT%\" + "%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat + popd +) + +:: Set home path +if not defined HOME set "HOME=%USERPROFILE%" +%lib_console% debug_output init.bat "Env Var - HOME=%HOME%" + +set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" +if exist "%CMDER_ROOT%\config\user_profile.cmd" ( + REM Create this file and place your own command in there + %lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd" + call "%CMDER_ROOT%\config\user_profile.cmd" +) + +if defined CMDER_USER_CONFIG ( + set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" + if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( + REM Create this file and place your own command in there + %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd + call "%CMDER_USER_CONFIG%\user_profile.cmd" + ) +) + +if not exist "%initialConfig%" ( + echo Creating user startup file: "%initialConfig%" + copy "%CMDER_ROOT%\vendor\user_profile.cmd.default" "%initialConfig%" +) + +if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( + echo Cmder's 'alias' command has been moved into "%CMDER_ROOT%\vendor\bin\alias.cmd" + echo to get rid of this message either: + echo. + echo Delete the file "%CMDER_ROOT%\bin\alias.bat" + echo. + echo or + echo. + echo If you have customized it and want to continue using it instead of the included version + echo * Rename "%CMDER_ROOT%\bin\alias.bat" to "%CMDER_ROOT%\bin\alias.cmd". + echo * Search for 'user-aliases' and replace it with 'user_aliases'. +) + +set initialConfig= + +:CMDER_CONFIGURED +if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1 + +set CMDER_INIT_END=%time% + +if %time_init% gtr 0 ( + "%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END% +) +exit /b From 334838c0792ba6bf806a8da77f819923b3f4b3c4 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Fri, 24 Jul 2020 08:34:45 -0400 Subject: [PATCH 235/371] Update init.bat --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index bcc0560..1b02674 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -370,7 +370,7 @@ if defined CMDER_USER_CONFIG ( set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd + %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd" call "%CMDER_USER_CONFIG%\user_profile.cmd" ) ) From 37a223b449cc163e0981a2319b400df4f6ccceea Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 25 Jul 2020 05:11:34 -0400 Subject: [PATCH 236/371] fix lib_path --- vendor/lib/lib_path.cmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 55d28cb..4032283 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -32,6 +32,7 @@ exit /b :::options: ::: ::: append Append to the path env variable rather than pre-pend. +::B ::: :::output: ::: @@ -168,7 +169,7 @@ exit /b set "position=" ) - dir "%add_path%" >NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL + dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL if "%ERRORLEVEL%" == "0" ( set "add_to_path=%add_path%" From cd50db3a7f286381628714a6f63755c16c0877a6 Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Wed, 29 Jul 2020 22:18:50 +0200 Subject: [PATCH 237/371] Use ERRORLEVEL instead of %errorlevel% to compare git versions %errorlevel% was always 0, even if the vendored git version was more current than the installed one Usually exiting a batch script with "exit /b exitCode" as used in :compare_versions sets %errorlevel% to the specified exit code However, this may not work if %errorlevel% was set before with "Set errorlevel=" I didn't find the location where this might have happened, but I saw the consequence of %errorlevel% always being 0 Thus I decided to use ERRORLEVEL instead as this will always work regardless of environment variable For more information check https://ss64.com/nt/errorlevel.html --- vendor/lib/lib_git.cmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 239e853..a78badf 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -231,15 +231,15 @@ exit /b :::------------------------------------------------------------------------------- :compare_git_versions - if %errorlevel% geq 0 ( + if ERRORLEVEL 0 ( :: compare the user git version against the vendored version %lib_git% compare_versions USER VENDORED :: use the user provided git if its version is greater than, or equal to the vendored git - if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( + if ERRORLEVEL 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" set test_dir= - ) else if %errorlevel% geq 0 ( + ) else if ERRORLEVEL 0 ( set "GIT_INSTALL_ROOT=%test_dir%" set test_dir= ) else ( @@ -249,7 +249,7 @@ exit /b ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found - if %errorlevel% equ -255 ( + IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( call :verbose_output No git at "%git_executable%" found. set test_dir= ) From 0ed10e5e890316920b746c8d3a3f4b9a292c4b0b Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Wed, 29 Jul 2020 22:39:46 +0200 Subject: [PATCH 238/371] Reorder if-else-clauses in :compare_git_versions so last else block can be reached It is hard to spot without the brackets, but the last else block - that resets %test_dir% and logs in verbose mode that an older user git version will be ignored - can't actually be reached. The else block is considered to belong to the if clause "if exist "%test_dir:~0,-4%\cmd\git.exe"" that will only ever be executed if ERRORLEVEL is greather than or equal to 0, thus if the test fails, the following else if clause "else if ERRORLEVEL 0" will always succeed and the last else block will be ignored. Using the vendored git version may still have worked because %GIT_INSTALL_ROOT% isn't set either way, but to enable the log message I reordered if-else-clauses and brackets in the way I think the original author intended them to work. --- vendor/lib/lib_git.cmd | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index a78badf..f61c4b2 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -236,12 +236,14 @@ exit /b %lib_git% compare_versions USER VENDORED :: use the user provided git if its version is greater than, or equal to the vendored git - if ERRORLEVEL 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( - set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" - set test_dir= - ) else if ERRORLEVEL 0 ( - set "GIT_INSTALL_ROOT=%test_dir%" - set test_dir= + if ERRORLEVEL 0 ( + if exist "%test_dir:~0,-4%\cmd\git.exe" ( + set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" + set test_dir= + ) else ( + set "GIT_INSTALL_ROOT=%test_dir%" + set test_dir= + ) ) else ( call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... set test_dir= From 167c49ee6da67ca336b20a172f6b9b8a5602c09f Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Wed, 29 Jul 2020 22:46:35 +0200 Subject: [PATCH 239/371] Rewrite old calls to :verbose_output to working %lib_console% verbose_output --- vendor/lib/lib_git.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index f61c4b2..b55ff6a 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -245,14 +245,14 @@ exit /b set test_dir= ) ) else ( - call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... + %lib_console% verbose_output "Found old %GIT_VERSION_USER% in %test_dir%, but not using..." set test_dir= ) ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( - call :verbose_output No git at "%git_executable%" found. + %lib_console% verbose_output "No git at "%git_executable%" found." set test_dir= ) ) From fc90722faaa26fa73e75b0e262950be659aedbf3 Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Wed, 29 Jul 2020 22:48:01 +0200 Subject: [PATCH 240/371] Prepend %GIT_INSTALL_ROOT%\cmd to path instead of appending it The default setting for path enhancing is appending, so the provided unix tools don't overwrite windows tools we may want to keep. For Git this is undesired behavior, though, as we just compared git versions to decide which one we want to use. The git directory thus needs to be prepended to the path to make sure a call to git uses the version we selected. --- vendor/init.bat | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 43683fc..4671ad0 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -231,7 +231,9 @@ goto :CONFIGURE_GIT :CONFIGURE_GIT %lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." :: Add git to the path -rem add the unix commands at the end to not shadow windows commands like more +if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" "" + +:: Add the unix commands at the end to not shadow windows commands like more if %nix_tools% equ 1 ( %lib_console% debug_output init.bat "Preferring Windows commands" set "path_position=append" @@ -240,7 +242,6 @@ if %nix_tools% equ 1 ( set "path_position=" ) -if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position% if %nix_tools% geq 1 ( if exist "%GIT_INSTALL_ROOT%\mingw32" ( %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% From 29d784b2b191db7a9df6ec23e610dd131835ca0f Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Wed, 29 Jul 2020 22:58:30 +0200 Subject: [PATCH 241/371] Update git for windows to 2.28.0 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 992f398..cd6d461 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.26.2.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-64-bit.7z.exe" + "version": "v2.28.0.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/PortableGit-2.28.0-64-bit.7z.exe" }, { "name": "clink", From 70aa573111b791ed5e615802de96c0ea81b1b0c9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 29 Jul 2020 20:39:37 -0400 Subject: [PATCH 242/371] changelog --- CHANGELOG.md | 8 +++++--- CONTRIBUTING.md | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a22ae2..0318c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # Change Log -## 1.3.16-pre - -* fix vscode terminal errors when setting cmder fast_init=1 outside cmder [#2339](https://github.com/cmderdev/cmder/pull/2339) +## [1.3.16](https://github.com/cmderdev/cmder/tree/v1.3.16) (2020-07-29) +* Merge pull request #2358 from FloSchwalm/update-to-git-2.28 [Dax T Games] +* Merge pull request #2357 from FloSchwalm/fix-git-version-comparison [Dax T Games] +* Merge pull request #2339 from daxgames/fix_global_vars_vscode_err [Dax T Games] + ## [1.3.15](https://github.com/cmderdev/cmder/tree/v1.3.15) (2020-06-26) * Fixes #2247, fixes #2254 [#2265](https://github.com/cmderdev/cmder/pull/2265) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 816d1e4..bbf8b43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,14 @@ # How to contribute Unfortunately we all can't work on cmder every day of the year, so I have decided to write some guidelines for contributing. +B If you follow them your contribution will likely be pulled in quicker. ## Getting Started * Fork the repository on GitHub (It's that easy) -* Create a feature branch based on the development branch. +* Create a feature branch based on the `master` branch. ## Making Changes From 28c416a15c0bc079b2a8a8a864927b87ef5e6e8b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 29 Jul 2020 20:41:29 -0400 Subject: [PATCH 243/371] changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0318c3c..89d6458 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,14 @@ ## [1.3.16](https://github.com/cmderdev/cmder/tree/v1.3.16) (2020-07-29) -* Merge pull request #2358 from FloSchwalm/update-to-git-2.28 [Dax T Games] +### Fixes + * Merge pull request #2357 from FloSchwalm/fix-git-version-comparison [Dax T Games] * Merge pull request #2339 from daxgames/fix_global_vars_vscode_err [Dax T Games] + +### Changes + +* Merge pull request #2358 from FloSchwalm/update-to-git-2.28 [Dax T Games] ## [1.3.15](https://github.com/cmderdev/cmder/tree/v1.3.15) (2020-06-26) From 794ae2ad60b871138537ae111395550f8ada264f Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 29 Jul 2020 20:42:14 -0400 Subject: [PATCH 244/371] changelog --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bbf8b43..1727944 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,6 @@ # How to contribute Unfortunately we all can't work on cmder every day of the year, so I have decided to write some guidelines for contributing. -B If you follow them your contribution will likely be pulled in quicker. From 3f6aa3b348396dee3300155b45c20f8c042624a4 Mon Sep 17 00:00:00 2001 From: mcnubblet Date: Thu, 13 Aug 2020 14:05:49 +1000 Subject: [PATCH 245/371] Update profile.ps1 Set utf-8 BOM in profile.ps1 to fix incorrect prompt display in PowerShell --- vendor/profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 5b940fd..ad9182a 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -1,4 +1,4 @@ -# Init Script for PowerShell +# Init Script for PowerShell # Created as part of cmder project # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED From 829a65f552288f092f0532e4bb03ea273ec90a90 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 13 Aug 2020 07:08:20 -0400 Subject: [PATCH 246/371] Revert "Update profile.ps1" --- vendor/profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index ad9182a..5b940fd 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -1,4 +1,4 @@ -# Init Script for PowerShell +# Init Script for PowerShell # Created as part of cmder project # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED From 937874f03c1efd54ef1ad1bbfe2c2141bb6ffb6e Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 13 Aug 2020 07:29:24 -0400 Subject: [PATCH 247/371] Revert "Revert "Update profile.ps1"" --- vendor/profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 5b940fd..ad9182a 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -1,4 +1,4 @@ -# Init Script for PowerShell +# Init Script for PowerShell # Created as part of cmder project # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED From e0aba110186ae21b6ba80f8ddd0270e5f62f54e7 Mon Sep 17 00:00:00 2001 From: mshepherd Date: Fri, 14 Aug 2020 17:19:39 -0500 Subject: [PATCH 248/371] Updates readme link to correct path Fixes capitalization Fixes opt to be bin Updates readme link to correct path --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 894e53f..fc6034d 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can ### Shared Cmder install with Non-Portable Individual User Config 1. Download the [latest release](https://github.com/cmderdev/cmder/releases/) 2. Extract the archive to a shared location. -3. (optional) Place your own executable files and custom app folders into the `%cmder_root%\bin`. See: [opt/README.md](./bin/README) +3. (optional) Place your own executable files and custom app folders into the `%cmder_root%\bin`. See: [bin/README.md](./bin/Readme.md) - This folder to be injected into your PATH by default. - See `/max_depth [1-5]` in 'Command Line Arguments for `init.bat`' table to add subdirectories recursively. -4. (optional) Place your own custom app folders into the `%cmder_root%\opt`. See: [opt/README.md](./opt/README) +4. (optional) Place your own custom app folders into the `%cmder_root%\opt`. See: [opt/README.md](./opt/Readme.md) - This folder will NOT be injected into your PATH so you have total control of what gets added. 5. Run `Cmder.exe` with `/C` command line argument. Example: `cmder.exe /C %userprofile%\cmder_config` * This will create the following directory structure if it is missing. From 92169c12957707f584c942473812680032900841 Mon Sep 17 00:00:00 2001 From: mshepherd Date: Fri, 14 Aug 2020 17:57:50 -0500 Subject: [PATCH 249/371] Deletes link to non-existent repo :( --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc6034d..9a2adbb 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ cd mintty-colors-solarized/ echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh>>$CMDER_ROOT/config/user_profile.sh ``` -You may find some Monokai color schemes for mintty to match Cmder [here](https://github.com/PhilipDaniels/mintty/blob/master/themes/Monokai) or [here](https://github.com/oumu/mintty-color-schemes/blob/master/base16-monokai-mod.minttyrc). +You may find some Monokai color schemes for mintty to match Cmder [here](https://github.com/oumu/mintty-color-schemes/blob/master/base16-monokai-mod.minttyrc). ### Changing Cmder Default `cmd.exe` Shell Startup Behaviour Using Task Arguments From b1ef763922db28f81ccb3098d2c0f6e502c8dbb8 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 23 Aug 2020 08:42:58 -0400 Subject: [PATCH 250/371] add setlocal --- vendor/lib/lib_git.cmd | 15 +++++++++------ vendor/lib/lib_path.cmd | 16 ++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index b55ff6a..b802efe 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -232,30 +232,33 @@ exit /b :compare_git_versions if ERRORLEVEL 0 ( + setlocal enabledelayedexpansion :: compare the user git version against the vendored version - %lib_git% compare_versions USER VENDORED + !lib_git! compare_versions USER VENDORED :: use the user provided git if its version is greater than, or equal to the vendored git if ERRORLEVEL 0 ( - if exist "%test_dir:~0,-4%\cmd\git.exe" ( - set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" + if exist "!test_dir:~0,-4!\cmd\git.exe" ( + set "GIT_INSTALL_ROOT=!test_dir:~0,-4!" set test_dir= ) else ( - set "GIT_INSTALL_ROOT=%test_dir%" + set "GIT_INSTALL_ROOT=!test_dir!" set test_dir= ) ) else ( - %lib_console% verbose_output "Found old %GIT_VERSION_USER% in %test_dir%, but not using..." + !lib_console! verbose_output "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." set test_dir= ) + endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( - %lib_console% verbose_output "No git at "%git_executable%" found." + !lib_console! verbose_output "No git at "!git_executable!" found." set test_dir= ) ) + exit /b :::=============================================================================== diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 4032283..9d81b98 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -77,24 +77,24 @@ exit /b set OLD_PATH=%PATH% setlocal enabledelayedexpansion - if "%found%" == "0" ( - echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;" + if "!found!" == "0" ( + echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;" call :set_found ) - %lib_console% debug_output :enhance_path "Env Var INSIDE PATH %find_query% - found=%found%" + !lib_console! debug_output :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!" - if /i "%position%" == "append" ( + if /i "!position!" == "append" ( if "!found!" == "0" ( - echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%\"$" + echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$" call :set_found ) - %lib_console% debug_output :enhance_path "Env Var END PATH %find_query% - found=!found!" + !lib_console! debug_output :enhance_path "Env Var END PATH !find_query! - found=!found!" ) else ( if "!found!" == "0" ( - echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:"^\"%find_query%;" + echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;" call :set_found ) - %lib_console% debug_output :enhance_path "Env Var BEGIN PATH %find_query% - found=!found!" + !lib_console! debug_output :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!" ) endlocal & set found=%found% From cda883bc39442c2317176f3834bfe07aecd225d6 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 23 Aug 2020 08:47:20 -0400 Subject: [PATCH 251/371] add setlocal --- vendor/lib/lib_git.cmd | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index b802efe..46df747 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -240,16 +240,13 @@ exit /b if ERRORLEVEL 0 ( if exist "!test_dir:~0,-4!\cmd\git.exe" ( set "GIT_INSTALL_ROOT=!test_dir:~0,-4!" - set test_dir= ) else ( set "GIT_INSTALL_ROOT=!test_dir!" - set test_dir= ) ) else ( !lib_console! verbose_output "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." - set test_dir= ) - endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% + endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% & set test_dir= ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found From d1adf16fa8700450a6c52ecf435f8c99968a86cb Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 24 Aug 2020 20:27:56 -0400 Subject: [PATCH 252/371] 'fixes' --- vendor/bin/cexec.cmd | 8 +++----- vendor/init.bat | 7 +++++-- vendor/lib/lib_git.cmd | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index ba69f3d..ee5efa8 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -1,5 +1,4 @@ @echo off -setlocal if "%~1" equ "" goto :wrongSyntax @@ -8,6 +7,7 @@ if not defined CMDER_USER_FLAGS ( set "CMDER_USER_FLAGS= " ) + set "feNot=false" goto :parseArgument @@ -17,10 +17,8 @@ goto :parseArgument :parseArgument set "currenArgu=%~1" if /i "%currenArgu%" equ "/setPath" ( - :: set %flag_exists% shortcut - endlocal - set "ccall=call ^"%~dp0cexec.cmd^"" - set "cexec=^"%~dp0cexec.cmd^"" + set ccall=call "%~dp0cexec.cmd" + set cexec="%~dp0cexec.cmd" ) else if /i "%currenArgu%" == "/?" ( goto :help ) else if /i "%currenArgu%" equ "/help" ( diff --git a/vendor/init.bat b/vendor/init.bat index 96ad751..5604319 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -265,14 +265,17 @@ if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^ if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" /usr/bin/locale ) +setlocal enabledelayedexpansion if defined git_locale ( - %lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" + + REM !lib_console! debug_output init.bat "Env Var - git_locale=!git_locale!" if not defined LANG ( - for /F "delims=" %%F in ('%git_locale% -uU 2') do ( + for /F "delims=" %%F in ('!git_locale! -uU 2') do ( set "LANG=%%F" ) ) ) +endlocal && set LANG=%LANG% %lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" %lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 46df747..55ae56b 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -231,8 +231,8 @@ exit /b :::------------------------------------------------------------------------------- :compare_git_versions + setlocal enabledelayedexpansion if ERRORLEVEL 0 ( - setlocal enabledelayedexpansion :: compare the user git version against the vendored version !lib_git! compare_versions USER VENDORED @@ -246,7 +246,6 @@ exit /b ) else ( !lib_console! verbose_output "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." ) - endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% & set test_dir= ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found @@ -255,6 +254,7 @@ exit /b set test_dir= ) ) + endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" && set test_dir= exit /b From 4378741aade2e93a74763516f97becace9a7b248 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 12 Sep 2020 06:10:41 -0400 Subject: [PATCH 253/371] add systeminfo.exe output --- vendor/bin/cmder_diag.cmd | 6 ++++++ vendor/bin/cmder_diag.ps1 | 6 ++++++ vendor/bin/cmder_diag.sh | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/vendor/bin/cmder_diag.cmd b/vendor/bin/cmder_diag.cmd index 9476512..66f41a1 100644 --- a/vendor/bin/cmder_diag.cmd +++ b/vendor/bin/cmder_diag.cmd @@ -35,6 +35,12 @@ echo where git echo ------------------------------------ where git +echo. +echo ------------------------------------ +echo systeminfo +echo ------------------------------------ +systeminfo + echo. echo ------------------------------------ echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! diff --git a/vendor/bin/cmder_diag.ps1 b/vendor/bin/cmder_diag.ps1 index 54ac8f6..f6ff930 100644 --- a/vendor/bin/cmder_diag.ps1 +++ b/vendor/bin/cmder_diag.ps1 @@ -33,6 +33,12 @@ write-host get-command git write-host ------------------------------------ get-command git +write-host '' +write-host ------------------------------------ +write-host systeminfo +write-host ------------------------------------ +systeminfo + write-host '' write-host ------------------------------------ write-host Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! diff --git a/vendor/bin/cmder_diag.sh b/vendor/bin/cmder_diag.sh index 1630933..fa49445 100644 --- a/vendor/bin/cmder_diag.sh +++ b/vendor/bin/cmder_diag.sh @@ -31,7 +31,13 @@ echo '' echo ------------------------------------ echo which git echo ------------------------------------ + which git +echo '' +echo ------------------------------------ +echo systeminfo +echo ------------------------------------ +systeminfo echo '' echo ------------------------------------ From ea6e18c83473ec2d9350e50608ca18250276d242 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Sep 2020 08:02:46 -0400 Subject: [PATCH 254/371] hide possible file write confilct --- vendor/lib/lib_git.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 55ae56b..b405224 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -49,7 +49,7 @@ exit /b :: get the git version in the provided directory - "%git_executable%" --version > "%temp%\git_version.txt" + "%git_executable%" --version 2>nul > "%temp%\git_version.txt" setlocal enabledelayedexpansion for /F "tokens=1,2,3 usebackq" %%A in (`type "%temp%\git_version.txt" 2^>nul`) do ( if /i "%%A %%B" == "git version" ( From 467b4d4ad913503e60e761283d12e7762cafb40a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 13 Sep 2020 08:27:10 -0400 Subject: [PATCH 255/371] hide possible file write conflict --- vendor/init.bat | 2 +- vendor/lib/lib_git.cmd | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 5604319..5d5b6ab 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -199,7 +199,7 @@ if defined GIT_INSTALL_ROOT ( %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% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd" 2>nul %lib_git% validate_version VENDORED %GIT_VERSION_VENDORED% :: check if git is in path... diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index b405224..7788d5a 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -48,8 +48,7 @@ exit /b ) :: get the git version in the provided directory - - "%git_executable%" --version 2>nul > "%temp%\git_version.txt" + "%git_executable%" --version > "%temp%\git_version.txt" setlocal enabledelayedexpansion for /F "tokens=1,2,3 usebackq" %%A in (`type "%temp%\git_version.txt" 2^>nul`) do ( if /i "%%A %%B" == "git version" ( @@ -272,7 +271,7 @@ exit /b :get_user_git_version :: get the version information for the user provided git binary - %lib_git% read_version USER "%test_dir%" + %lib_git% read_version USER "%test_dir%" 2>nul %lib_git% validate_version USER %GIT_VERSION_USER% exit /b From 220546194342fd27a0e3c3293d2d7d6c2002daec Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Tue, 27 Oct 2020 18:31:19 +0100 Subject: [PATCH 256/371] Update git for windows to 2.29.1 (#2410) --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index cd6d461..2a843f1 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.28.0.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/PortableGit-2.28.0-64-bit.7z.exe" + "version": "v2.29.1.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.29.1.windows.1/PortableGit-2.29.1-64-bit.7z.exe" }, { "name": "clink", From 44f5095047c2e5056884eca90082e13ebcf73061 Mon Sep 17 00:00:00 2001 From: Alex Kostyukov Date: Tue, 27 Oct 2020 20:32:05 +0300 Subject: [PATCH 257/371] fix docs for user-aliases.cmd #2397 (#2398) --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9a2adbb..b6e18c0 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ | `/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` | -| `/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 | | (custom arguments) | User defined arguments processed by `cexec`. Type `cexec /?` for more useage. | not set | @@ -206,14 +206,14 @@ You can define simple aliases for `cmd.exe` sessions with a command like `alias Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/doskey) for additional details on complex aliases/macros for `cmd.exe` -Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\user-aliases.cmd` file +Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\user_aliases.cmd` file To make an alias and/or any other profile settings permanent add it to one of the following: Note: These are loaded in this order by `$CMDER_ROOT/vendor/init.bat`. Anything stored in `%CMDER_ROOT%` will be a portable setting and will follow cmder to another machine. * `%CMDER_ROOT%\config\profile.d\*.cmd` and `\*.bat` -* `%CMDER_ROOT%\config\user-aliases.cmd` +* `%CMDER_ROOT%\config\user_aliases.cmd` * `%CMDER_ROOT%\config\user_profile.cmd` #### Bash.exe|Mintty.exe Aliases @@ -278,7 +278,7 @@ Uncomment and edit the below line in the script to use Cmder config even when la # CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. ``` -### Customizing user sessions using `init.bat` custom arguments. +### Customizing user sessions using `init.bat` custom arguments. You can pass custom arguments to `init.bat` and use `cexec.cmd` in your `user_profile.cmd` to evaluate these arguments then execute commands based on a particular flag being detected or not. @@ -289,7 +289,7 @@ arguments then execute commands based on a particular flag being detected or not ``` ccall=call C:\Users\user\cmderdev\vendor\bin\cexec.cmd -``` +``` Example: `%ccall% /startnotepad start notepad.exe` @@ -311,17 +311,17 @@ To conditionally start `notepad.exe` when you start a specific `cmder` task: * Add the below to the `Commands` block: ```batch - + cmd.exe /k ""%ConEmuDir%\..\init.bat" /startnotepad" - + ``` * Add the below to your `%cmder_root%\config\user_profile.cmd` ```batch - + %ccall% "/startNotepad" "start" "notepad.exe"` - + ``` To see detailed usage of `cexec`, type `cexec /?` in cmder. From f4988480f6a109f08cc3e17a0bddc8338730be2a Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 6 Dec 2020 09:23:23 -0500 Subject: [PATCH 258/371] debug --- vendor/lib/lib_path.cmd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 9d81b98..defbe5a 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -112,6 +112,10 @@ exit /b :end_enhance_path set "PATH=%PATH:;;=;%" + + echo add_to_path: %add_to_path% + echo position: %position% + echo PATH: %PATH% if NOT "%OLD_PATH%" == "%PATH%" ( %lib_console% debug_output :enhance_path "END Env Var - PATH=%path%" %lib_console% debug_output :enhance_path "Env Var %find_query% - found=%found%" From 4874e78953ac826f9dd50b489fedcf17cbc9abc3 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 6 Dec 2020 10:56:58 -0500 Subject: [PATCH 259/371] remove debug --- vendor/lib/lib_path.cmd | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index defbe5a..9d81b98 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -112,10 +112,6 @@ exit /b :end_enhance_path set "PATH=%PATH:;;=;%" - - echo add_to_path: %add_to_path% - echo position: %position% - echo PATH: %PATH% if NOT "%OLD_PATH%" == "%PATH%" ( %lib_console% debug_output :enhance_path "END Env Var - PATH=%path%" %lib_console% debug_output :enhance_path "Env Var %find_query% - found=%found%" From 2a9a4d28606ea33cffe89044e9b56522579b25ae Mon Sep 17 00:00:00 2001 From: Kyle McInnes Date: Mon, 7 Dec 2020 19:41:11 +0000 Subject: [PATCH 260/371] Speed up calls to lib_console --- vendor/init.bat | 48 +++++++++++++++++++------------------- vendor/lib/lib_console.cmd | 5 ++++ vendor/lib/lib_git.cmd | 26 ++++++++++----------- vendor/lib/lib_path.cmd | 34 +++++++++++++-------------- vendor/lib/lib_profile.cmd | 2 +- 5 files changed, 60 insertions(+), 55 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 5604319..7f52dd1 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -67,7 +67,7 @@ call "%cmder_root%\vendor\lib\lib_profile" set "max_depth=%~2" shift ) else ( - %lib_console% show_error "'/max_depth' requires a number between 1 and 5!" + %print_error% "'/max_depth' requires a number between 1 and 5!" exit /b ) ) else if /i "%1" == "/c" ( @@ -88,7 +88,7 @@ call "%cmder_root%\vendor\lib\lib_profile" set "GIT_INSTALL_ROOT=%~2" shift ) else ( - %lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" + %print_error% "The Git install root folder "%~2", you specified does not exist!" exit /b ) ) else if /i "%1"=="/nix_tools" ( @@ -110,7 +110,7 @@ call "%cmder_root%\vendor\lib\lib_profile" set "HOME=%~2" shift ) else ( - %lib_console% show_error The home folder "%2", you specified does not exist! + %print_error% The home folder "%2", you specified does not exist! exit /b ) ) else if /i "%1" == "/svn_ssh" ( @@ -125,11 +125,11 @@ goto var_loop :start :: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES %lib_base% cmder_shell -%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" -%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%" +%print_debug% init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" +%print_debug% init.bat "Env Var - debug_output=%debug_output%" if defined CMDER_USER_CONFIG ( - %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" + %print_debug% init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" if not exist "%CMDER_USER_CONFIG%\opt" md "%CMDER_USER_CONFIG%\opt" ) @@ -144,7 +144,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" ( ) if "%CMDER_CLINK%" == "1" ( - %lib_console% verbose_output "Injecting Clink!" + %print_verbose% "Injecting Clink!" :: Run clink if defined CMDER_USER_CONFIG ( @@ -163,15 +163,15 @@ if "%CMDER_CLINK%" == "1" ( "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) ) else ( - %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" + %print_verbose% "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" ) if "%CMDER_CONFIGURED%" GTR "1" ( - %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" + %print_verbose% "Cmder is already configured, skipping Cmder Init!" goto USER_ALIASES ) else if "%CMDER_CONFIGURED%" == "1" ( - %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!" + %print_verbose% "Cmder is already configured, skipping to Cmder User Init!" goto USER_CONFIG_START ) @@ -191,12 +191,12 @@ 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!" + %print_debug% "Skipping Git Auto-Detect!" goto :VENDORED_GIT ) ) -%lib_console% debug_output init.bat "Looking for Git install root..." +%print_debug% 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" @@ -218,31 +218,31 @@ 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 '%GIT_VERSION_VENDORED%'..." + %print_debug% "Using vendored Git '%GIT_VERSION_VENDORED%'..." goto :CONFIGURE_GIT ) else ( goto :NO_GIT ) :SPECIFIED_GIT -%lib_console% debug_output "Using /GIT_INSTALL_ROOT..." +%print_debug% "Using /GIT_INSTALL_ROOT..." goto :CONFIGURE_GIT :FOUND_GIT -%lib_console% debug_output "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." +%print_debug% "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." goto :CONFIGURE_GIT :CONFIGURE_GIT -%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." +%print_debug% "Using Git from '%GIT_INSTALL_ROOT%..." :: Add git to the path if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" "" :: Add the unix commands at the end to not shadow windows commands like more if %nix_tools% equ 1 ( - %lib_console% verbose_output "Preferring Windows commands" + %print_verbose% "Preferring Windows commands" set "path_position=append" ) else ( - %lib_console% verbose_output "Preferring *nix commands" + %print_verbose% "Preferring *nix commands" set "path_position=" ) @@ -268,7 +268,7 @@ if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nu setlocal enabledelayedexpansion if defined git_locale ( - REM !lib_console! debug_output init.bat "Env Var - git_locale=!git_locale!" + REM !print_debug! init.bat "Env Var - git_locale=!git_locale!" if not defined LANG ( for /F "delims=" %%F in ('!git_locale! -uU 2') do ( set "LANG=%%F" @@ -277,8 +277,8 @@ if defined git_locale ( ) endlocal && set LANG=%LANG% -%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" -%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" +%print_debug% init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" +%print_debug% init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" goto :PATH_ENHANCE :NO_GIT @@ -361,12 +361,12 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( :: Set home path if not defined HOME set "HOME=%USERPROFILE%" -%lib_console% debug_output init.bat "Env Var - HOME=%HOME%" +%print_debug% init.bat "Env Var - HOME=%HOME%" set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" if exist "%CMDER_ROOT%\config\user_profile.cmd" ( REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd" + %print_debug% init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd" call "%CMDER_ROOT%\config\user_profile.cmd" ) @@ -374,7 +374,7 @@ if defined CMDER_USER_CONFIG ( set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( REM Create this file and place your own command in there - %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd" + %print_debug% init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd" call "%CMDER_USER_CONFIG%\user_profile.cmd" ) ) diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index 2b18d15..e88ff99 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -3,6 +3,11 @@ call "%~dp0lib_base.cmd" set lib_console=call "%~dp0lib_console.cmd" +:: Much faster than using "%lib_console% debug_output ..." etc. +set print_debug=if %debug_output% gtr 0 %lib_console% debug_output %* +set print_verbose=if %verbose_output% gtr 0 %lib_console% verbose_output %* +set print_error=%lib_console% show_error %* + if "%fast_init%" == "1" exit /b if "%~1" == "/h" ( diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 55ae56b..31c33b4 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -39,11 +39,11 @@ exit /b :: set the executable path set "git_executable=%~2\git.exe" - %lib_console% debug_output :read_version "Env Var - git_executable=%git_executable%" + %print_debug% :read_version "Env Var - git_executable=%git_executable%" :: check if the executable actually exists if not exist "%git_executable%" ( - %lib_console% debug_output :read_version "%git_executable% does not exist." + %print_debug% :read_version "%git_executable% does not exist." exit /b -255 ) @@ -60,7 +60,7 @@ exit /b exit /b ) ) - endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%" & %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%GIT_VERSION%" + endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%" & %print_debug% :read_version "Env Var - GIT_VERSION_%~1=%GIT_VERSION%" exit /b @@ -90,7 +90,7 @@ exit /b :::------------------------------------------------------------------------------- :: process a `x.x.x.xxxx.x` formatted string - %lib_console% debug_output :parse_version "ARGV[1]=%~1, ARGV[2]=%~2" + %print_debug% :parse_version "ARGV[1]=%~1, ARGV[2]=%~2" setlocal enabledelayedexpansion for /F "tokens=1-3* delims=.,-" %%A in ("%2") do ( @@ -130,16 +130,16 @@ exit /b :::------------------------------------------------------------------------------- :: now parse the version information into the corresponding variables - %lib_console% debug_output :validate_version "ARGV[1]=%~1, ARGV[2]=%~2" + %print_debug% :validate_version "ARGV[1]=%~1, ARGV[2]=%~2" call :parse_version %~1 %~2 :: ... and maybe display it, for debugging purposes. - REM %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" + REM %print_debug% :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" if "%~1" == "VENDORED" ( - %lib_console% debug_output :validate_version "Found Git Version for %~1: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%" + %print_debug% :validate_version "Found Git Version for %~1: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%" ) else ( - %lib_console% debug_output :validate_version "Found Git Version for %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%" + %print_debug% :validate_version "Found Git Version for %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%" ) exit /b @@ -164,9 +164,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: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD% - %lib_console% debug_output %~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD% + %print_debug% Comparing: + %print_debug% %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD% + %print_debug% %~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD% setlocal enabledelayedexpansion if !%~1_MAJOR! GTR !%~2_MAJOR! (endlocal & exit /b 1) @@ -244,13 +244,13 @@ exit /b set "GIT_INSTALL_ROOT=!test_dir!" ) ) else ( - !lib_console! verbose_output "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." + !print_verbose! "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." ) ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( - !lib_console! verbose_output "No git at "!git_executable!" found." + !print_verbose! "No git at "!git_executable!" found." set test_dir= ) ) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 9d81b98..1ae3b18 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -42,7 +42,7 @@ exit /b if "%~1" neq "" ( set "add_path=%~1" ) else ( - %lib_console% show_error "You must specify a directory to add to the path!" + %print_error% "You must specify a directory to add to the path!" exit 1 ) @@ -81,29 +81,29 @@ exit /b echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;" call :set_found ) - !lib_console! debug_output :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!" + !print_debug! :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!" if /i "!position!" == "append" ( if "!found!" == "0" ( echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$" call :set_found ) - !lib_console! debug_output :enhance_path "Env Var END PATH !find_query! - found=!found!" + !print_debug! :enhance_path "Env Var END PATH !find_query! - found=!found!" ) else ( if "!found!" == "0" ( echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;" call :set_found ) - !lib_console! debug_output :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!" + !print_debug! :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!" ) endlocal & set found=%found% if "%found%" == "0" ( if /i "%position%" == "append" ( - %lib_console% debug_output :enhance_path "Appending '%add_to_path%'" + %print_debug% :enhance_path "Appending '%add_to_path%'" set "PATH=%PATH%;%add_to_path%" ) else ( - %lib_console% debug_output :enhance_path "Prepending '%add_to_path%'" + %print_debug% :enhance_path "Prepending '%add_to_path%'" set "PATH=%add_to_path%;%PATH%" ) @@ -113,8 +113,8 @@ exit /b :end_enhance_path set "PATH=%PATH:;;=;%" if NOT "%OLD_PATH%" == "%PATH%" ( - %lib_console% debug_output :enhance_path "END Env Var - PATH=%path%" - %lib_console% debug_output :enhance_path "Env Var %find_query% - found=%found%" + %print_debug% :enhance_path "END Env Var - PATH=%path%" + %print_debug% :enhance_path "Env Var %find_query% - found=%found%" ) set "position=" exit /b @@ -156,7 +156,7 @@ exit /b if "%~1" neq "" ( set "add_path=%~1" ) else ( - %lib_console% show_error "You must specify a directory to add to the path!" + %print_error% "You must specify a directory to add to the path!" exit 1 ) @@ -188,14 +188,14 @@ exit /b exit /b ) - %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_to_path%" - %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%" - %lib_console% debug_output :enhance_path_recursive "Env Var - depth=%depth%" - %lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%" + %print_debug% :enhance_path_recursive "Env Var - add_path=%add_to_path%" + %print_debug% :enhance_path_recursive "Env Var - position=%position%" + %print_debug% :enhance_path_recursive "Env Var - depth=%depth%" + %print_debug% :enhance_path_recursive "Env Var - max_depth=%max_depth%" if %max_depth% gtr %depth% ( if "%add_to_path%" neq "" ( - %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_to_path%'" + %print_debug% :enhance_path_recursive "Adding parent directory - '%add_to_path%'" call :enhance_path "%add_to_path%" %position% ) call :set_depth @@ -216,10 +216,10 @@ exit /b ) for /d %%i in ("%add_path%\*") do ( - %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=%depth%" - %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'" + %print_debug% :enhance_path_recursive "Env Var BEFORE - depth=%depth%" + %print_debug% :enhance_path_recursive "Found Subdirectory - '%%~fi'" call :enhance_path_recursive "%%~fi" %depth% %max_depth% %position% - %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=%depth%" + %print_debug% :enhance_path_recursive "Env Var AFTER- depth=%depth%" ) exit /b diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 32bb77a..a34f4a0 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -38,7 +38,7 @@ exit /b pushd "%~1" for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( - %lib_console% verbose_output "Calling '%~1\%%x'..." + %print_verbose% "Calling '%~1\%%x'..." call "%~1\%%x" ) popd From 11a78a8d6498a68cee8adb6fe61ae6943edc546f Mon Sep 17 00:00:00 2001 From: Kyle McInnes Date: Thu, 10 Dec 2020 13:35:40 +0000 Subject: [PATCH 261/371] Fix errors --- vendor/init.bat | 2 +- vendor/lib/lib_console.cmd | 6 +++--- vendor/lib/lib_git.cmd | 4 ++-- vendor/lib/lib_path.cmd | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 7f52dd1..945e318 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -268,7 +268,7 @@ if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nu setlocal enabledelayedexpansion if defined git_locale ( - REM !print_debug! init.bat "Env Var - git_locale=!git_locale!" + REM %print_debug% init.bat "Env Var - git_locale=!git_locale!" if not defined LANG ( for /F "delims=" %%F in ('!git_locale! -uU 2') do ( set "LANG=%%F" diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index e88ff99..a98b8cb 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -4,9 +4,9 @@ call "%~dp0lib_base.cmd" set lib_console=call "%~dp0lib_console.cmd" :: Much faster than using "%lib_console% debug_output ..." etc. -set print_debug=if %debug_output% gtr 0 %lib_console% debug_output %* -set print_verbose=if %verbose_output% gtr 0 %lib_console% verbose_output %* -set print_error=%lib_console% show_error %* +set print_debug=if %debug_output% gtr 0 %lib_console% debug_output +set print_verbose=if %verbose_output% gtr 0 %lib_console% verbose_output +set print_error=%lib_console% show_error if "%fast_init%" == "1" exit /b diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 31c33b4..85b1597 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -244,13 +244,13 @@ exit /b set "GIT_INSTALL_ROOT=!test_dir!" ) ) else ( - !print_verbose! "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." + %print_verbose% "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." ) ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( - !print_verbose! "No git at "!git_executable!" found." + %print_verbose% "No git at "!git_executable!" found." set test_dir= ) ) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 1ae3b18..0da0da8 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -81,20 +81,20 @@ exit /b echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;" call :set_found ) - !print_debug! :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!" + %print_debug% :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!" if /i "!position!" == "append" ( if "!found!" == "0" ( echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$" call :set_found ) - !print_debug! :enhance_path "Env Var END PATH !find_query! - found=!found!" + %print_debug% :enhance_path "Env Var END PATH !find_query! - found=!found!" ) else ( if "!found!" == "0" ( echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;" call :set_found ) - !print_debug! :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!" + %print_debug% :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!" ) endlocal & set found=%found% From 00b22ea79a62b389462b1014ca15f58288fe187b Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Thu, 17 Dec 2020 13:26:59 +0300 Subject: [PATCH 262/371] Update clink-completions to 0.3.6 (#2440) https://github.com/vladimir-kotikov/clink-completions/releases/tag/0.3.6 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 2a843f1..66ad13d 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -16,7 +16,7 @@ }, { "name": "clink-completions", - "version": "0.3.5", - "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.5.zip" + "version": "0.3.6", + "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.6.zip" } ] From e0b8ebc6697697f50f1c01afda3cab0850785b49 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Mon, 21 Dec 2020 16:30:30 -0500 Subject: [PATCH 263/371] Clink fork fixes (#2441) * debug * remove debug * Switch to chrisant996 Clink 1.1.8 * Update to Clink 1.1 10 * CHANGELOG.md Co-authored-by: dgames --- CHANGELOG.md | 14 ++++++++++++++ vendor/sources.json | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89d6458..e0ba2e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## [Unreleased] + +### Fixes + +- Switch to @chrisant996 [Clink](https://github.com/chrisant996/clink/) v1.1.10 to fix Clink newer Windows 10 releases. +- Fix `\Git\cmd\git.exe found. was unexpected at this time.` +- Documentation fixes. + +### Changes + +- Update Git to 2.29.0 +- Improve `init.bat` Speed +- Add `systeminfo.exe` output to iag scripts. + ## [1.3.16](https://github.com/cmderdev/cmder/tree/v1.3.16) (2020-07-29) ### Fixes diff --git a/vendor/sources.json b/vendor/sources.json index 66ad13d..6996719 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "0.4.9", - "url": "https://github.com/mridgers/clink/releases/download/0.4.9/clink_0.4.9.zip" + "version": "1.1.10", + "url": "https://github.com/chrisant996/clink/releases/download/v1.1.10/clink.1.1.10.125c9f.zip" }, { "name": "conemu-maximus5", From 24cad3ed5cb183452adc1cd5e048ba24a058590c Mon Sep 17 00:00:00 2001 From: dgames Date: Wed, 23 Dec 2020 07:30:47 -0500 Subject: [PATCH 264/371] fix 'alias ..=cd ..' removing 2 char aliases --- vendor/bin/alias.cmd | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index ccac5df..2eca8f2 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -81,6 +81,9 @@ set alias_name=!alias_name:~1! :: trailing quotes added while validating set alias_value=!alias_value:~0,-1! +:: '.' escaped +set alias_name_esc=!alias_name:.=\.! + ::remove spaces set _temp=%alias_name: =% @@ -91,7 +94,7 @@ if not ["%_temp%"] == ["%alias_name%"] ( ) :: replace already defined alias -%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" +%WINDIR%\System32\findstr /v /i "^%alias_name_esc%=" "%ALIASES%" >> "%ALIASES%.tmp" echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey /macrofile="%ALIASES%" endlocal @@ -99,7 +102,11 @@ exit /b :p_del set del_alias=%~1 -%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" + +:: '.' escaped +set del_alias_esc=!del_alias:.=\.! + +%WINDIR%\System32\findstr /v /i "^%del_alias_esc%=" "%ALIASES%" >> "%ALIASES%.tmp" type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey %del_alias%= doskey /macrofile="%ALIASES%" From bb2f89d0444be4dc67ba66b2da5a7d59211dbaf1 Mon Sep 17 00:00:00 2001 From: dgames Date: Wed, 23 Dec 2020 07:33:12 -0500 Subject: [PATCH 265/371] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0ba2e3..0acd3c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- [bug] Running `alias ..=cd ..` removes other aliases #2394 - Switch to @chrisant996 [Clink](https://github.com/chrisant996/clink/) v1.1.10 to fix Clink newer Windows 10 releases. - Fix `\Git\cmd\git.exe found. was unexpected at this time.` - Documentation fixes. From ae0b7722ed4a419b2db31c70937efb427c0b70f2 Mon Sep 17 00:00:00 2001 From: dgames Date: Wed, 23 Dec 2020 07:55:16 -0500 Subject: [PATCH 266/371] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0acd3c0..fff27ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [Unreleased] +## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23) ### Fixes From da0af1d96b467431771f4d3a575f6253f774f370 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 24 Dec 2020 12:14:46 -0500 Subject: [PATCH 267/371] 1.3.17 Fixes for clink settings and history --- vendor/init.bat | 6 ++++++ vendor/sources.json | 4 ++-- vendor/user_aliases.cmd.default | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 8f50b88..cb1a8e9 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -397,6 +397,12 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD echo * Search for 'user-aliases' and replace it with 'user_aliases'. ) +alias history |find /i "cat" >nul +if "%ERRORLEVEL%" == "0" ( + echo Migrating alias 'history' to new Clink 1.x.x... + "%CMDER_ROOT%\vendor\bin\alias.cmd" history="^%%CMDER_ROOT^%%\vendor\clink\clink.bat" history +) + set initialConfig= :CMDER_CONFIGURED diff --git a/vendor/sources.json b/vendor/sources.json index 6996719..64eeb9f 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.1.10", - "url": "https://github.com/chrisant996/clink/releases/download/v1.1.10/clink.1.1.10.125c9f.zip" + "version": "1.1.14", + "url": "https://github.com/chrisant996/clink/releases/download/v1.1.14/clink.1.1.14.a44ba3.zip" }, { "name": "conemu-maximus5", diff --git a/vendor/user_aliases.cmd.default b/vendor/user_aliases.cmd.default index 4221684..7427eda 100644 --- a/vendor/user_aliases.cmd.default +++ b/vendor/user_aliases.cmd.default @@ -9,7 +9,7 @@ gl=git log --oneline --all --graph --decorate $* ls=ls --show-control-chars -F --color $* pwd=cd clear=cls -history=cat -n "%CMDER_ROOT%\config\.history" +history="%cmder_root%\vendor\clink\clink.bat" history unalias=alias /d $1 vi=vim $* cmderr=cd /d "%CMDER_ROOT%" From 783cf68d10436e8322550a9706bce018dc6606b4 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 24 Dec 2020 17:48:00 -0500 Subject: [PATCH 268/371] CLink migration and clenaup --- CHANGELOG.md | 11 ++- vendor/clink_settings.default | 133 +++++++--------------------------- vendor/init.bat | 50 ++++++++++--- 3 files changed, 77 insertions(+), 117 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fff27ed..de3c1b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,18 @@ # Change Log -## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23) +## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.18) (2020-12-24) ### Fixes +- Update to Clink v1.1.14 to fix #2451. + - Clink `%cmder_root%\config\settings` is migrated from a previous install if `%cmder_root%\config\clink_settings` does not exist. + - This is a best effort migration of Clink 1.x.x supported settings. + - Clink `%cmder_root%\config\.history` is migrated from a previous install if `%cmder_root%\config\clink_history` does not exist. +- `init.bat` auto migrates the history alias to use `clink history` if required. + +## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23) +### Fixes + - [bug] Running `alias ..=cd ..` removes other aliases #2394 - Switch to @chrisant996 [Clink](https://github.com/chrisant996/clink/) v1.1.10 to fix Clink newer Windows 10 releases. - Fix `\Git\cmd\git.exe found. was unexpected at this time.` diff --git a/vendor/clink_settings.default b/vendor/clink_settings.default index 97420e2..2520c01 100644 --- a/vendor/clink_settings.default +++ b/vendor/clink_settings.default @@ -1,116 +1,39 @@ -# name: Pressing Ctrl-D exits session -# type: bool -# Ctrl-D exits cmd.exe when it is pressed on an empty line. -ctrld_exits = 1 +# For explanation of these and other settings see: +# https://chrisant996.github.io/clink/clink.html -# name: Toggle if pressing Esc clears line -# type: bool -# Clink clears the current line when Esc is pressed (unless Readline's Vi mode -# is enabled). -esc_clears_line = 1 +# name: Shell command completions +# type: color +color.cmd = bold -# name: Match display colour -# type: int -# Colour to use when displaying matches. A value less than 0 will be the -# opposite brightness of the default colour. -match_colour = -1 +# name: Doskey completions +# type: color +color.doskey = bright cyan -# name: Executable match style -# type: enum -# 0 = PATH only -# 1 = PATH and CWD -# 2 = PATH, CWD, and directories -# Changes how Clink will match executables when there is no path separator on -# the line. 0 = PATH only, 1 = PATH and CWD, 2 = PATH, CWD, and directories. In -# all cases both executables and directories are matched when there is a path -# separator present. A value of -1 will disable executable matching completely. -exec_match_style = 2 +# name: Filtered completion color +# type: color +color.filtered = bold -# name: Whitespace prefix matches files -# type: bool -# If the line begins with whitespace then Clink bypasses executable matching and -# will match all files and directories instead. -space_prefix_match_files = 1 +# name: For user-interaction prompts +# type: color +color.interact = bold -# name: Colour of the prompt -# type: int -# Surrounds the prompt in ANSI escape codes to set the prompt's colour. Disabled -# when the value is less than 0. -prompt_colour = -1 - -# name: Auto-answer terminate prompt -# type: enum -# 0 = Disabled -# 1 = Answer 'Y' -# 2 = Answer 'N' -# Automatically answers cmd.exe's 'Terminate batch job (Y/N)?' prompts. 0 = -# disabled, 1 = answer 'Y', 2 = answer 'N'. -terminate_autoanswer = 0 - -# name: Lines of history saved to disk -# type: int -# When set to a positive integer this is the number of lines of history that -# will persist when Clink saves the command history to disk. Use 0 for infinite -# lines and <0 to disable history persistence. -history_file_lines = 10000 - -# name: Skip adding lines prefixed with whitespace -# type: bool -# Ignore lines that begin with whitespace when adding lines in to the history. -history_ignore_space = 0 - -# name: Controls how duplicate entries are handled -# type: enum -# 0 = Always add -# 1 = Ignore -# 2 = Erase previous -# If a line is a duplicate of an existing history entry Clink will erase the -# duplicate when this is set 2. A value of 1 will not add duplicates to the -# history and a value of 0 will always add lines. Note that history is not -# deduplicated when reading/writing to disk. -history_dupe_mode = 2 - -# name: Read/write history file each line edited -# type: bool -# When non-zero the history will be read from disk before editing a new line and -# written to disk afterwards. -history_io = 1 +# name: Message area color +# type: color +color.message = default # name: Sets how command history expansion is applied # type: enum -# 0 = Off -# 1 = On -# 2 = Not in single quotes -# 3 = Not in double quote -# 4 = Not in any quotes -# The '!' character in an entered line can be interpreted to introduce words -# from the history. This can be enabled and disable by setting this value to 1 -# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double, -# or both quotes respectively. -history_expand_mode = 3 +# options: off,on,not_squoted,not_dquoted,not_quoted +history.expand_mode = not_dquoted -# name: Support Windows' Ctrl-Alt substitute for AltGr -# type: bool -# Windows provides Ctrl-Alt as a substitute for AltGr, historically to support -# keyboards with no AltGr key. This may collide with some of Readline's -# bindings. -use_altgr_substitute = 1 +# name: Skip adding lines prefixed with whitespace +# type: boolean +history.ignore_space = False -# name: Strips CR and LF chars on paste -# type: enum -# 0 = Paste unchanged -# 1 = Strip -# 2 = As space -# Setting this to a value >0 will make Clink strip CR and LF characters from -# text pasted into the current line. Set this to 1 to strip all newline -# characters and 2 to replace them with a space. -strip_crlf_on_paste = 2 - -# name: Enables basic ANSI escape code support -# type: bool -# When printing the prompt, Clink has basic built-in support for SGR ANSI escape -# codes to control the text colours. This is automatically disabled if a third -# party tool is detected that also provides this facility. It can also be -# disabled by setting this to 0. -ansi_code_support = 1 +# name: The number of history lines to save +# type: integer +history.max_lines = 10000 +# name: Share history between instances +# type: boolean +history.shared = True diff --git a/vendor/init.bat b/vendor/init.bat index cb1a8e9..928aa30 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -148,18 +148,39 @@ if "%CMDER_CLINK%" == "1" ( :: Run clink if defined CMDER_USER_CONFIG ( - if not exist "%CMDER_USER_CONFIG%\settings" ( + if not exist "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\clink_settings" ( echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" - copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings" - echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\clink_settings" + echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup. + ) + + REM Cleanup lagacy Clink Settings file + if exist "%CMDER_USER_CONFIG%\settings" if exist "%CMDER_USER_CONFIG%\clink_settings" ( + del "%CMDER_USER_CONFIG%\settings" + ) + + REM Cleanup legacy CLink history file + if exist "%CMDER_USER_CONFIG%\.history" if exist "%CMDER_USER_CONFIG%\clink_history" ( + del "%CMDER_USER_CONFIG%\.history" ) "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor" ) else ( - if not exist "%CMDER_ROOT%\config\settings" ( - echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" - copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings" + if not exist "%CMDER_ROOT%\config\settings" if not exist "%CMDER_ROOT%\config\clink_settings" ( + echo Generating clink initial settings in "%CMDER_ROOT%\config\clink_settings" + copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\clink_settings" echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) + + REM Cleanup lagacy Clink Settings file + if exist "%CMDER_ROOT%\config\settings" if exist "%CMDER_ROOT%\config\clink_settings" ( + del "%CMDER_ROOT%\config\settings" + ) + + REM Cleanup legacy Clink history file + if exist "%CMDER_ROOT%\config\.history" if exist "%CMDER_ROOT%\config\clink_history" ( + del "%CMDER_ROOT%\config\.history" + ) + "%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" ) ) else ( @@ -345,6 +366,13 @@ if "%CMDER_ALIASES%" == "1" ( ) :: Add aliases to the environment +type "%user_aliases%" | findstr /b /l /i "history=cat " >nul +if "%ERRORLEVEL%" == "0" ( + echo Migrating alias 'history' to new Clink 1.x.x... + call "%CMDER_ROOT%\vendor\bin\alias.cmd" /d history + echo Restart the session to activate changes! +) + call "%user_aliases%" if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED @@ -397,11 +425,11 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD echo * Search for 'user-aliases' and replace it with 'user_aliases'. ) -alias history |find /i "cat" >nul -if "%ERRORLEVEL%" == "0" ( - echo Migrating alias 'history' to new Clink 1.x.x... - "%CMDER_ROOT%\vendor\bin\alias.cmd" history="^%%CMDER_ROOT^%%\vendor\clink\clink.bat" history -) +:: alias history |find /i "cat" >nul +:: if "%ERRORLEVEL%" == "0" ( +:: echo Migrating alias 'history' to new Clink 1.x.x... +:: "%CMDER_ROOT%\vendor\bin\alias.cmd" history="^%%CMDER_ROOT^%%\vendor\clink\clink.bat" history +:: ) set initialConfig= From f362ba8dba053890678ddd480d105498393966ab Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 24 Dec 2020 17:55:56 -0500 Subject: [PATCH 269/371] spacing --- vendor/bin/alias.cmd | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index 2eca8f2..ac2525c 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -81,9 +81,6 @@ set alias_name=!alias_name:~1! :: trailing quotes added while validating set alias_value=!alias_value:~0,-1! -:: '.' escaped -set alias_name_esc=!alias_name:.=\.! - ::remove spaces set _temp=%alias_name: =% @@ -94,7 +91,7 @@ if not ["%_temp%"] == ["%alias_name%"] ( ) :: replace already defined alias -%WINDIR%\System32\findstr /v /i "^%alias_name_esc%=" "%ALIASES%" >> "%ALIASES%.tmp" +%WINDIR%\System32\findstr /b /l /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp" echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey /macrofile="%ALIASES%" endlocal @@ -103,10 +100,7 @@ exit /b :p_del set del_alias=%~1 -:: '.' escaped -set del_alias_esc=!del_alias:.=\.! - -%WINDIR%\System32\findstr /v /i "^%del_alias_esc%=" "%ALIASES%" >> "%ALIASES%.tmp" +%WINDIR%\System32\findstr /b /l /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp" type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp" doskey %del_alias%= doskey /macrofile="%ALIASES%" From b5d172cd3200d4e57c9197618d87ff822600709b Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 24 Dec 2020 18:33:10 -0500 Subject: [PATCH 270/371] cleanup --- vendor/init.bat | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 928aa30..864668f 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -425,12 +425,6 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD echo * Search for 'user-aliases' and replace it with 'user_aliases'. ) -:: alias history |find /i "cat" >nul -:: if "%ERRORLEVEL%" == "0" ( -:: echo Migrating alias 'history' to new Clink 1.x.x... -:: "%CMDER_ROOT%\vendor\bin\alias.cmd" history="^%%CMDER_ROOT^%%\vendor\clink\clink.bat" history -:: ) - set initialConfig= :CMDER_CONFIGURED From ba1027f6d5b7b0cca406435af9edbafb5b77c3f8 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 24 Dec 2020 18:34:27 -0500 Subject: [PATCH 271/371] cleanup --- vendor/user_aliases.cmd.default | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/user_aliases.cmd.default b/vendor/user_aliases.cmd.default index 7427eda..45f44a7 100644 --- a/vendor/user_aliases.cmd.default +++ b/vendor/user_aliases.cmd.default @@ -9,7 +9,6 @@ gl=git log --oneline --all --graph --decorate $* ls=ls --show-control-chars -F --color $* pwd=cd clear=cls -history="%cmder_root%\vendor\clink\clink.bat" history unalias=alias /d $1 vi=vim $* cmderr=cd /d "%CMDER_ROOT%" From 01d300f779643665b0c6714dcde83a0e342ab56d Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 24 Dec 2020 18:43:23 -0500 Subject: [PATCH 272/371] cleanup --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 864668f..d7427a7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -149,7 +149,7 @@ if "%CMDER_CLINK%" == "1" ( :: Run clink if defined CMDER_USER_CONFIG ( if not exist "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\clink_settings" ( - echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" + echo Generating clink initial settings in "%CMDER_USER_CONFIG%\clink_settings" copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\clink_settings" echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup. ) From 9cf3ba222ee3931694dba3f75260257cd3345a3c Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 9 Jan 2021 09:43:37 -0500 Subject: [PATCH 273/371] remove clink defaults --- vendor/clink_settings.default | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/vendor/clink_settings.default b/vendor/clink_settings.default index 2520c01..7e296b3 100644 --- a/vendor/clink_settings.default +++ b/vendor/clink_settings.default @@ -1,26 +1,6 @@ # For explanation of these and other settings see: # https://chrisant996.github.io/clink/clink.html -# name: Shell command completions -# type: color -color.cmd = bold - -# name: Doskey completions -# type: color -color.doskey = bright cyan - -# name: Filtered completion color -# type: color -color.filtered = bold - -# name: For user-interaction prompts -# type: color -color.interact = bold - -# name: Message area color -# type: color -color.message = default - # name: Sets how command history expansion is applied # type: enum # options: off,on,not_squoted,not_dquoted,not_quoted From 2d75a635dec18a72e428f82128af3c5bb1cd5616 Mon Sep 17 00:00:00 2001 From: Anton Makarenko Date: Mon, 11 Jan 2021 14:22:54 +0700 Subject: [PATCH 274/371] Fix: Incomplete operation when closing bash.exe --- vendor/ConEmu.xml.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/ConEmu.xml.default b/vendor/ConEmu.xml.default index c4f4fff..4046fc2 100644 --- a/vendor/ConEmu.xml.default +++ b/vendor/ConEmu.xml.default @@ -549,14 +549,14 @@ - + - + From 3608b5bc817f81f3ac629e6cdb402739a09d4af0 Mon Sep 17 00:00:00 2001 From: Anton Makarenko Date: Mon, 11 Jan 2021 15:03:52 +0700 Subject: [PATCH 275/371] Added quotes as in previous commits --- vendor/ConEmu.xml.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/ConEmu.xml.default b/vendor/ConEmu.xml.default index 4046fc2..f3fcc1a 100644 --- a/vendor/ConEmu.xml.default +++ b/vendor/ConEmu.xml.default @@ -549,14 +549,14 @@ - + - + From 6c15598010dbe1dd38c9fbb4bc5ab362cdd05914 Mon Sep 17 00:00:00 2001 From: dgames Date: Tue, 12 Jan 2021 09:01:39 -0500 Subject: [PATCH 276/371] update to Clink 1.1.20 --- CHANGELOG.md | 4 ++-- vendor/sources.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de3c1b6..84efd3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Change Log -## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.18) (2020-12-24) +## [Unreleased] ### Fixes -- Update to Clink v1.1.14 to fix #2451. +- Update to Clink 1.1.20 to fix #2451. - Clink `%cmder_root%\config\settings` is migrated from a previous install if `%cmder_root%\config\clink_settings` does not exist. - This is a best effort migration of Clink 1.x.x supported settings. - Clink `%cmder_root%\config\.history` is migrated from a previous install if `%cmder_root%\config\clink_history` does not exist. diff --git a/vendor/sources.json b/vendor/sources.json index 64eeb9f..4e8f012 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.1.14", - "url": "https://github.com/chrisant996/clink/releases/download/v1.1.14/clink.1.1.14.a44ba3.zip" + "version": "1.1.20", + "url": "https://github.com/chrisant996/clink/releases/download/v1.1.20/clink.1.1.20.fa19d6.zip" }, { "name": "conemu-maximus5", From 10d63daf90ac679d66bab70c999323f4819321d2 Mon Sep 17 00:00:00 2001 From: Stephen Solis Date: Sat, 16 Jan 2021 23:34:22 +0100 Subject: [PATCH 277/371] Fix enhance_path call if no usr\bin in %GIT_INSTALL_ROOT% --- vendor/init.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 8f50b88..f5fdd77 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -251,9 +251,9 @@ if %nix_tools% geq 1 ( %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position% + ) else if exist "%GIT_INSTALL_ROOT%\usr\bin" ( + %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 From 633d673bd702e8e466c320259fc92326a0175e10 Mon Sep 17 00:00:00 2001 From: FTOH Date: Sun, 17 Jan 2021 22:13:01 +0700 Subject: [PATCH 278/371] Fix escaping double quotes --- vendor/ConEmu.xml.default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/ConEmu.xml.default b/vendor/ConEmu.xml.default index f3fcc1a..9d7b296 100644 --- a/vendor/ConEmu.xml.default +++ b/vendor/ConEmu.xml.default @@ -549,14 +549,14 @@ - + - + From cc1d459ea95816891ceb0dd3aba897e29cdaa7db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AE=E9=99=8C?= Date: Mon, 8 Feb 2021 23:23:30 +0800 Subject: [PATCH 279/371] Fix some commands like ls' are not available --- vendor/init.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index f5fdd77..8c10a0c 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -251,7 +251,8 @@ if %nix_tools% geq 1 ( %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position% - ) else if exist "%GIT_INSTALL_ROOT%\usr\bin" ( + ) + if exist "%GIT_INSTALL_ROOT%\usr\bin" ( %lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" %path_position% ) ) From 8452f33407cffc37b6abf76e839b48c5c6163097 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 25 Feb 2021 14:38:05 -0500 Subject: [PATCH 280/371] changelog.md --- CHANGELOG.md | 5 +---- vendor/sources.json | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84efd3a..a04213d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,7 @@ ### Fixes -- Update to Clink 1.1.20 to fix #2451. - - Clink `%cmder_root%\config\settings` is migrated from a previous install if `%cmder_root%\config\clink_settings` does not exist. - - This is a best effort migration of Clink 1.x.x supported settings. - - Clink `%cmder_root%\config\.history` is migrated from a previous install if `%cmder_root%\config\clink_history` does not exist. +- Update to Clink 1.1.34 to fix #2451, #2465, and #2473 - `init.bat` auto migrates the history alias to use `clink history` if required. ## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23) diff --git a/vendor/sources.json b/vendor/sources.json index 4e8f012..1a08926 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.1.20", - "url": "https://github.com/chrisant996/clink/releases/download/v1.1.20/clink.1.1.20.fa19d6.zip" + "version": "1.1.34", + "url": "https://github.com/chrisant996/clink/releases/download/v1.1.34/clink.1.1.34.d161e9.zip" }, { "name": "conemu-maximus5", From d02be816e266db62594684e22df0880771503ca0 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 28 Feb 2021 21:54:06 -0500 Subject: [PATCH 281/371] fix failure in lib_path if path is too long --- vendor/lib/lib_path.cmd | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 0da0da8..d88ae91 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -112,13 +112,28 @@ exit /b :end_enhance_path set "PATH=%PATH:;;=;%" - if NOT "%OLD_PATH%" == "%PATH%" ( + + if not "%OLD_PATH:~0,3000%" == "%OLD_PATH:~0,3001%" goto :toolong + if not "%PATH:~0,3000%" == "%PATH:~0,3001%" goto :toolong + if not "%OLD_PATH%" == "%PATH%" goto :changed + exit /b + + :toolong + echo %OLD_PATH%>tempfileA + echo %PATH%>tempfileB + fc /b tempfileA tempfileB 2>nul 1>nul + if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) + del tempfileA & del tempfileB + exit /b + + :changed %print_debug% :enhance_path "END Env Var - PATH=%path%" %print_debug% :enhance_path "Env Var %find_query% - found=%found%" - ) - set "position=" + exit /b + exit /b + :set_found if "%ERRORLEVEL%" == "0" ( set found=1 From 0a7f1623f74d3556a20629ba3386fcb72e594f7e Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 28 Feb 2021 23:09:49 -0500 Subject: [PATCH 282/371] fix path length check with fast_init set --- vendor/lib/lib_path.cmd | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index d88ae91..725b549 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -113,18 +113,20 @@ exit /b :end_enhance_path set "PATH=%PATH:;;=;%" + REM echo %path%|"C:\Users\dgames\cmder - dev\vendor\git-for-windows\usr\bin\wc" -c + if "%fast_init%" == "1" exit /b + if not "%OLD_PATH:~0,3000%" == "%OLD_PATH:~0,3001%" goto :toolong - if not "%PATH:~0,3000%" == "%PATH:~0,3001%" goto :toolong if not "%OLD_PATH%" == "%PATH%" goto :changed exit /b :toolong - echo %OLD_PATH%>tempfileA - echo %PATH%>tempfileB - fc /b tempfileA tempfileB 2>nul 1>nul - if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) - del tempfileA & del tempfileB - exit /b + echo %OLD_PATH%>tempfileA + echo %PATH%>tempfileB + fc /b tempfileA tempfileB 2>nul 1>nul + if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) + del tempfileA & del tempfileB + exit /b :changed %print_debug% :enhance_path "END Env Var - PATH=%path%" From e918b18ca7d72c001a9f2682f523cdd6ce764269 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 25 Mar 2021 19:13:03 -0400 Subject: [PATCH 283/371] CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a04213d..7c75ddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ ### Fixes -- Update to Clink 1.1.34 to fix #2451, #2465, and #2473 +- Update to Clink 1.1.45 to fix #2451, #2465, and #2473 - `init.bat` auto migrates the history alias to use `clink history` if required. +- Remove Tilde match from clink.lua in favor of builtin Clink capability. ## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23) ### Fixes From 0fd2d9c8a8ddd3ed84878b8eb4302bc459c4a886 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 25 Mar 2021 19:14:18 -0400 Subject: [PATCH 284/371] CHANGELOG.md --- vendor/clink.lua | 17 ----------------- vendor/sources.json | 8 ++++---- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 8d72186..4ba4dd6 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -406,24 +406,7 @@ local function svn_prompt_filter() return false end -local function tilde_match (text, f, l) - if text == '~' then - clink.add_match(clink.get_env('userprofile')) - clink.matches_are_files() - return true - end - - if text:sub(1, 1) == '~' then - clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1)) - -- second match prevents adding a space so we can look for more matches - clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1) .. '+') - clink.matches_are_files() - return true - end -end - -- insert the set_prompt at the very beginning so that it runs first -clink.register_match_generator(tilde_match, 1) clink.prompt.register_filter(set_prompt_filter, 1) clink.prompt.register_filter(hg_prompt_filter, 50) clink.prompt.register_filter(git_prompt_filter, 50) diff --git a/vendor/sources.json b/vendor/sources.json index 1a08926..5b69c31 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,13 +6,13 @@ }, { "name": "clink", - "version": "1.1.34", - "url": "https://github.com/chrisant996/clink/releases/download/v1.1.34/clink.1.1.34.d161e9.zip" + "version": "1.1.45", + "url": "https://github.com/chrisant996/clink/releases/download/v1.1.45/clink.1.1.45.1c3985.zip" }, { "name": "conemu-maximus5", - "version": "191012", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v19.10.12/ConEmuPack.191012.7z" + "version": "210304", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.03.04/ConEmuPack.210304.7z" }, { "name": "clink-completions", From f7df79a2d7edfd6ce5c64a17b40533d38d4612e9 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 26 Mar 2021 05:41:17 -0400 Subject: [PATCH 285/371] CHANGELOG.md --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c75ddd..5d265de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # Change Log -## [Unreleased] +## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.18) (2021-3-26) -### Fixes +### Changes - Update to Clink 1.1.45 to fix #2451, #2465, and #2473 +- Update to ConEmu v21.03.04 - `init.bat` auto migrates the history alias to use `clink history` if required. - Remove Tilde match from clink.lua in favor of builtin Clink capability. From 6027ac31c428a3b9a5cf12424d4d95787e279023 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Wed, 7 Apr 2021 22:30:53 -0400 Subject: [PATCH 286/371] set global cmderGitStatusOptIn var for use in clink-completions --- vendor/clink.lua | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 4ba4dd6..320ac76 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -285,15 +285,24 @@ end -- @return {bool} --- local function get_git_status_setting() - gitStatusSetting = io.popen("git --no-pager config -l 2>nul") + local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul") - for line in gitStatusSetting:lines() do - if string.match(line, 'cmder.status=false') or string.match(line, 'cmder.cmdstatus=false') then - gitStatusSetting:close() + for line in gitStatusConfig:lines() do + if string.match(line, 'false') then + gitStatusConfig:close() return false end end - gitStatusSetting:close() + + local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul") + for line in gitCmdStatusConfig:lines() do + if string.match(line, 'false') then + gitCmdStatusConfig:close() + return false + end + end + gitStatusConfig:close() + gitCmdStatusConfig:close() return true end @@ -308,8 +317,8 @@ local function git_prompt_filter() } local git_dir = get_git_dir() - - if get_git_status_setting() then + cmderGitStatusOptIn = get_git_status_setting() + if cmderGitStatusOptIn then if git_dir then -- if we're inside of git repo then try to detect current branch local branch = get_git_branch(git_dir) From ad755dc7f932b5455a041e8a584d21e13a434d8f Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Fri, 9 Apr 2021 10:46:27 +0300 Subject: [PATCH 287/371] Bump clink-completions version --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 5b69c31..b970955 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -16,7 +16,7 @@ }, { "name": "clink-completions", - "version": "0.3.6", - "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.6.zip" + "version": "0.3.7", + "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.7.zip" } ] From 0ef76ee2d3555d2fc967b5c61fdafda0933f50b3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 11 Apr 2021 18:28:43 -0400 Subject: [PATCH 288/371] add configurable prompt --- vendor/clink.lua | 54 +++++++++++++++++++++----- vendor/cmder_prompt_config.lua.default | 42 ++++++++++++++++++++ vendor/init.bat | 10 +++++ 3 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 vendor/cmder_prompt_config.lua.default diff --git a/vendor/clink.lua b/vendor/clink.lua index 320ac76..d0e1264 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -21,6 +21,16 @@ local function verbatim(s) return s end +-- Extracts only the folder name from the input Path +-- Ex: Input C:\Windows\System32 returns System32 +--- +local function get_folder_name(path) + local reversePath = string.reverse(path) + local slashIndex = string.find(reversePath, "\\") + return string.sub(path, string.len(path) - slashIndex + 2) +end + + --- -- Setting the prompt in clink means that commands which rewrite the prompt do -- not destroy our own prompt. It also means that started cmds (or batch files @@ -44,17 +54,43 @@ local function set_prompt_filter() -- also check for square brackets if env == nil then env = old_prompt:match('.*%[([^%]]+)%].+:') end - -- build our own prompt - -- orig: $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m - -- color codes: "\x1b[1;37;40m" - local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m" - local lambda = "λ" - cmder_prompt = string.gsub(cmder_prompt, "{cwd}", verbatim(cwd)) + -- Much of the below was 'borrowed' from https://github.com/AmrEldib/cmder-powerline-prompt + -- Symbol displayed for the home dir in the prompt. + if not prompt_homeSymbol then + prompt_homeSymbol = "~" + end + + -- Symbol displayed in the new line below the prompt. + if not prompt_lambSymbol then + prompt_lambSymbol = "λ" + end + + if prompt_type == 'folder' then + cwd = get_folder_name(cwd) + end + + if prompt_useHomeSymbol and string.find(cwd, clink.get_env("HOME")) then + cwd = string.gsub(cwd, clink.get_env("HOME"), prompt_homeSymbol) + end + + uah = '' + if prompt_useUserAtHost then + uah = clink.get_env("USERNAME") .. "@" .. clink.get_env("COMPUTERNAME") .. ' ' + end + + cr = "\n" + if prompt_singleLine then + cr = ' ' + end if env ~= nil then - lambda = "("..env..") "..lambda + prompt_lambSymbol = "("..env..") "..prompt_lambSymbol end - clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", verbatim(lambda)) + + prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{lamb} \x1b[0m" + uah_value = string.gsub(prompt, "{uah}", uah) + new_value = string.gsub(uah_value, "{cwd}", cwd) + clink.prompt.value = string.gsub(new_value, "{lamb}", prompt_lambSymbol) end local function percent_prompt_filter() @@ -335,7 +371,7 @@ local function git_prompt_filter() if gitConflict then color = colors.conflict - end + end clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") return false diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default new file mode 100644 index 0000000..9d6360d --- /dev/null +++ b/vendor/cmder_prompt_config.lua.default @@ -0,0 +1,42 @@ +-- All of the below was 'borrowed' from https://github.com/AmrEldib/cmder-powerline-prompt + +--- REQUIRED. config_prompt_type is whether the displayed prompt is the full path or only the folder name + -- Use: + -- "full" for full path like C:\Windows\System32 + -- "folder" for folder name only like System32 + -- default is full +prompt_type = "full" + +--- REQUIRED. config_prompt_useHomeSymbol is whether to show ~ instead of the full path to the user's home folder + -- Use true or false + -- default is false +prompt_useHomeSymbol = false + +-- Symbols +-- REQUIRED. Prompt displayed instead of user's home folder e.g. C:\Users\username + -- default is '~' +prompt_homeSymbol = "~" + +-- REQUIRED. Symbol displayed in the new line below the prompt. + -- default is 'λ' +prompt_lambSymbol = "λ" + +-- REQUIRED. Adds [user]@[host] to the beginning of the prompt like bash + -- default is false +prompt_useUserAtHost = false + +-- REQUIRED. If true prompt is a single line instead of default two line prompt. + -- default is false +prompt_singleLine = false + +-- Prompt Attributes +-- +-- Colors +-- Green: "\x1b[1;33;40m" +-- Yellow: "\x1b[1;32;40m" +-- Light Grey: "\x1b[1;30;40m" + +-- Prompt Element Colors +uah_color = "\x1b[1;33;40m" -- Green = uah = [user]@[hostname] +cwd_color = "\x1b[1;32;40m" -- Yellow cwd = Current Working Directory +lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color diff --git a/vendor/init.bat b/vendor/init.bat index 36f5024..3b1bf6a 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -154,6 +154,11 @@ if "%CMDER_CLINK%" == "1" ( echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup. ) + if not exist "%CMDER_USER_CONFIG%\cmder_prompt_config.lua" ( + echo Creating Cmder prompt config file: "%CMDER_USER_CONFIG%\cmder_prompt_config.lua" + copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_USER_CONFIG%\cmder_prompt_config.lua" + ) + REM Cleanup lagacy Clink Settings file if exist "%CMDER_USER_CONFIG%\settings" if exist "%CMDER_USER_CONFIG%\clink_settings" ( del "%CMDER_USER_CONFIG%\settings" @@ -171,6 +176,11 @@ if "%CMDER_CLINK%" == "1" ( echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. ) + if not exist "%CMDER_ROOT%\config\cmder_prompt_config.lua" ( + echo Creating Cmder prompt config file: "%CMDER_ROOT%\config\cmder_prompt_config.lua" + copy "%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default" "%CMDER_ROOT%\config\cmder_prompt_config.lua" + ) + REM Cleanup lagacy Clink Settings file if exist "%CMDER_ROOT%\config\settings" if exist "%CMDER_ROOT%\config\clink_settings" ( del "%CMDER_ROOT%\config\settings" From e0cb86d7382a2ca36e25e9264073f687e81b75d7 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 11 Apr 2021 18:42:43 -0400 Subject: [PATCH 289/371] parametrized status colors --- vendor/clink.lua | 14 +++++++------- vendor/cmder_prompt_config.lua.default | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index d0e1264..c01d6be 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -347,9 +347,9 @@ local function git_prompt_filter() -- Colors for git status local colors = { - clean = "\x1b[1;37;40m", - dirty = "\x1b[33;3m", - conflict = "\x1b[31;1m" + clean = clean_color, + dirty = dirty_color, + conflict = conflict_color } local git_dir = get_git_dir() @@ -392,8 +392,8 @@ local function hg_prompt_filter() if hg_dir then -- Colors for mercurial status local colors = { - clean = "\x1b[1;37;40m", - dirty = "\x1b[31;1m", + clean = clean_color, + dirty = dirty_color, } local pipe = io.popen("hg branch 2>&1") @@ -426,8 +426,8 @@ end local function svn_prompt_filter() -- Colors for svn status local colors = { - clean = "\x1b[1;37;40m", - dirty = "\x1b[31;1m", + clean = clean_color, + dirty = dirty_color, } if get_svn_dir() then diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 9d6360d..5e59c14 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -40,3 +40,6 @@ prompt_singleLine = false uah_color = "\x1b[1;33;40m" -- Green = uah = [user]@[hostname] cwd_color = "\x1b[1;32;40m" -- Yellow cwd = Current Working Directory lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color +clean_color = "\x1b[1;37;40m" +dirty_color = "\x1b[33;3m" +conflict_color = "\x1b[31;1m" From 3752b9521891a275496c6cea49a4ce8324c84064 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 11 Apr 2021 18:52:59 -0400 Subject: [PATCH 290/371] CHANGELG.md --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d265de..522affb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## [Unreleased] + +### Adds + +- Configurable promtpt for `cmd.exe` sessions. See `%cmder_root%\config\cmder_prompt_config.lua` + - Configurable colors + - Option to change `λ` to another character. + - Option to add `[user]@[host]` to the prompt + - Option to use of `~` to represent `$HOME` folder. + - Option to use folder name vs. full working directory path in prompt. + - Option to use single line prompt. + +### Fixes + +- Git prompt opt-out works better with additional changes to `clink-completions` + ## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.18) (2021-3-26) ### Changes From 8fa351810aa8ca810c14c46ef68ffe39578379ba Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 11 Apr 2021 18:54:26 -0400 Subject: [PATCH 291/371] CHANGELG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 522affb..488eab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Adds -- Configurable promtpt for `cmd.exe` sessions. See `%cmder_root%\config\cmder_prompt_config.lua` +- Configurable prompt for `cmd.exe` sessions. See `%cmder_root%\config\cmder_prompt_config.lua` - Configurable colors - Option to change `λ` to another character. - Option to add `[user]@[host]` to the prompt From d9b2c729f9a35672e835046e38fd081e2e16c893 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 15 Apr 2021 07:54:39 -0400 Subject: [PATCH 292/371] replace :: with rem --- vendor/bin/vscode_init.cmd | 2 +- vendor/bin/vscode_init_args.cmd.default | 92 ++++++++++++------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/vendor/bin/vscode_init.cmd b/vendor/bin/vscode_init.cmd index bbe1ba2..79b0ea8 100644 --- a/vendor/bin/vscode_init.cmd +++ b/vendor/bin/vscode_init.cmd @@ -1,6 +1,6 @@ @echo off -:: Find root dir +rem Find root dir if not defined CMDER_ROOT ( for /f "delims=" %%i in ("%~dp0\..\..") do ( diff --git a/vendor/bin/vscode_init_args.cmd.default b/vendor/bin/vscode_init_args.cmd.default index 8ee8f89..4a17d93 100644 --- a/vendor/bin/vscode_init_args.cmd.default +++ b/vendor/bin/vscode_init_args.cmd.default @@ -1,58 +1,58 @@ @echo off -:: Below are the default Cmder session settings: -:: -:: See "%CMDER_ROOT%\README.md" for details on these settings. -:: -:: `Cmder.exe` Arguments: -:: ---------------------- -:: -:: `/c [cmder_user_cfg_root] -:: set cmder_user_bin=[cmder_user_cfg_root]\bin -:: set cmder_user_config=[cmder_user_cfg_root]\config -:: -:: `init.bat` Arguments -:: -------------------- -:: -:: `/d` -:: debug_output=0 -:: -:: `/v` -:: verbose_output=0 -:: -:: `/f` -:: fast_init=0 -:: -:: `/nix_tools` -:: nix_tools=1 -:: -:: `/t` -:: time_init=0 -:: -:: `/max_depth` -:: max_depth=1 -:: -:: `/user_aliases` -:: user_aliases= -:: -:: `/git_install_root` -:: GIT_INSTALL_ROOT= -:: -:: `/home` -:: HOME= -:: -:: `/svn_ssh` -:: SVN_SSH= +rem Below are the default Cmder session settings: +rem +rem See "%CMDER_ROOT%\README.md" for details on these settings. +rem +rem `Cmder.exe` Arguments: +rem ---------------------- +rem +rem `/c [cmder_user_cfg_root] +rem set cmder_user_bin=[cmder_user_cfg_root]\bin +rem set cmder_user_config=[cmder_user_cfg_root]\config +rem +rem `init.bat` Arguments +rem -------------------- +rem +rem `/d` +rem debug_output=0 +rem +rem `/v` +rem verbose_output=0 +rem +rem `/f` +rem fast_init=0 +rem +rem `/nix_tools` +rem nix_tools=1 +rem +rem `/t` +rem time_init=0 +rem +rem `/max_depth` +rem max_depth=1 +rem +rem `/user_aliases` +rem user_aliases= +rem +rem `/git_install_root` +rem GIT_INSTALL_ROOT= +rem +rem `/home` +rem HOME= +rem +rem `/svn_ssh` +rem SVN_SSH= echo Applying Cmder VSCode settings from '%~0'... if defined CMDER_CONFIGURED ( - :: Set Cmder settings here for when VSCode is launched inside Cmder. + rem Set Cmder settings here for when VSCode is launched inside Cmder. set verbose_output=1 ) else ( - :: Set Cmder settings here for when VSCode is launched from outside Cmder. + rem Set Cmder settings here for when VSCode is launched from outside Cmder. set verbose_output=1 ) -:: Set all required Cmder VSCode terminal environment settings above this line. +rem Set all required Cmder VSCode terminal environment settings above this line. echo Applying Cmder VSCode settings is complete! From 9793ca1ed908e61b84a6f36427836a14e314212e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 15 Apr 2021 08:17:07 -0400 Subject: [PATCH 293/371] update git for windows --- CHANGELOG.md | 4 ++++ vendor/sources.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 488eab7..cc61977 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Changes + +- Update Git for Windows to 2.31.1 + ### Adds - Configurable prompt for `cmd.exe` sessions. See `%cmder_root%\config\cmder_prompt_config.lua` diff --git a/vendor/sources.json b/vendor/sources.json index 5b69c31..2c7e595 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.29.1.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.29.1.windows.1/PortableGit-2.29.1-64-bit.7z.exe" + "version": "v2.31.1.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.31.1.windows.1/PortableGit-2.31.1-64-bit.7z.exe" }, { "name": "clink", From e8df3ef24717098b5c4f1bb1af09db33ac1326ee Mon Sep 17 00:00:00 2001 From: Abhishek Aryan <22198661+Lunchb0ne@users.noreply.github.com> Date: Sun, 2 May 2021 21:53:22 +0300 Subject: [PATCH 294/371] Refactor the env substution logic And some prompt cleanup --- vendor/clink.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index c01d6be..ab28858 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -83,14 +83,13 @@ local function set_prompt_filter() cr = ' ' end - if env ~= nil then - prompt_lambSymbol = "("..env..") "..prompt_lambSymbol - end + if env ~= nil then env = "("..env..") " else env = "" end - prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{lamb} \x1b[0m" - uah_value = string.gsub(prompt, "{uah}", uah) - new_value = string.gsub(uah_value, "{cwd}", cwd) - clink.prompt.value = string.gsub(new_value, "{lamb}", prompt_lambSymbol) + prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{env}{lamb} \x1b[0m" + prompt = string.gsub(prompt, "{uah}", uah) + prompt = string.gsub(prompt, "{cwd}", cwd) + prompt = string.gsub(prompt, "{env}", env) + clink.prompt.value = string.gsub(prompt, "{lamb}", prompt_lambSymbol) end local function percent_prompt_filter() From 810a3da955abdef51c85cff9651cf02e4c56fd4d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 May 2021 20:54:52 -0400 Subject: [PATCH 295/371] upgrade to clink 1.2.5 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index b552653..9be554f 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.1.45", - "url": "https://github.com/chrisant996/clink/releases/download/v1.1.45/clink.1.1.45.1c3985.zip" + "version": "1.2.5", + "url": "https://github.com/chrisant996/clink/releases/download/v1.1.45/clink.1.2.5.5dd017.zip" }, { "name": "conemu-maximus5", From 11fb1b3a505d2bdf047d63631048407f23c0497b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 May 2021 20:56:02 -0400 Subject: [PATCH 296/371] do not rely on config\cmder_prompt_config.lua --- vendor/clink.lua | 60 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index c01d6be..a35c225 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -13,6 +13,34 @@ dofile(clink_lua_file) -- now add our own things... + +local function get_uah_color() + return uah_color or "\x1b[1;33;40m" -- Green = uah = [user]@[hostname] +end + +local function get_cwd_color() + return cwd_color or "\x1b[1;32;40m" -- Yellow cwd = Current Working Directory +end + +local function get_lamb_color() + return lamb_color or "\x1b[1;30;40m" -- Light Grey = Lambda Color +end + + +local function get_clean_color() + return clean_color or "\x1b[1;37;40m" +end + + +local function get_dirty_color() + return dirty_color or "\x1b[33;3m" +end + + +local function get_conflict_color() + return conflict_color or "\x1b[31;1m" +end + --- -- Makes a string safe to use as the replacement in string.gsub --- @@ -65,6 +93,22 @@ local function set_prompt_filter() prompt_lambSymbol = "λ" end + if not prompt_type then + prompt_type = "full" + end + + if prompt_useHomeSymbol == nil then + prompt_useHomeSymbol = false + end + + if prompt_useUserAtHost == nil then + prompt_useUserAtHost = false + end + + if prompt_singleLine == nil then + prompt_singleLine = false + end + if prompt_type == 'folder' then cwd = get_folder_name(cwd) end @@ -87,7 +131,7 @@ local function set_prompt_filter() prompt_lambSymbol = "("..env..") "..prompt_lambSymbol end - prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{lamb} \x1b[0m" + prompt = get_uah_color() .. "{uah}" .. get_cwd_color() .. "{cwd}{git}{hg}{svn}" .. get_lamb_color() .. cr .. "{lamb} \x1b[0m" uah_value = string.gsub(prompt, "{uah}", uah) new_value = string.gsub(uah_value, "{cwd}", cwd) clink.prompt.value = string.gsub(new_value, "{lamb}", prompt_lambSymbol) @@ -347,9 +391,9 @@ local function git_prompt_filter() -- Colors for git status local colors = { - clean = clean_color, - dirty = dirty_color, - conflict = conflict_color + clean = get_clean_color(), + dirty = get_dirty_color(), + conflict = get_conflict_color() } local git_dir = get_git_dir() @@ -392,8 +436,8 @@ local function hg_prompt_filter() if hg_dir then -- Colors for mercurial status local colors = { - clean = clean_color, - dirty = dirty_color, + clean = get_clean_color(), + dirty = get_dirty_color(), } local pipe = io.popen("hg branch 2>&1") @@ -426,8 +470,8 @@ end local function svn_prompt_filter() -- Colors for svn status local colors = { - clean = clean_color, - dirty = dirty_color, + clean = get_clean_color(), + dirty = get_dirty_color(), } if get_svn_dir() then From d6b5fe8e1d2fef4d8714829f77ce3c3d90a36cdd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 May 2021 20:56:17 -0400 Subject: [PATCH 297/371] CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc61977..77d2fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ### Changes - Update Git for Windows to 2.31.1 +- Update to Clink 1.2.5 +- Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` ### Adds From 59941f5dfa4c00f667875d8de6d686afe8a14766 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 2 May 2021 21:05:58 -0400 Subject: [PATCH 298/371] cleanup --- vendor/sources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/sources.json b/vendor/sources.json index e0ddca1..f2423a4 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -7,7 +7,7 @@ { "name": "clink", "version": "1.2.5", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.55/clink.1.2.5.5dd017.zip" + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.5/clink.1.2.5.5dd017.zip" }, { "name": "conemu-maximus5", From f1665ddd7df3d8f0f1f26adf57beacde05217100 Mon Sep 17 00:00:00 2001 From: Abhishek Aryan <22198661+Lunchb0ne@users.noreply.github.com> Date: Mon, 10 May 2021 18:47:17 +0300 Subject: [PATCH 299/371] Fix no env in the prompt string Yeah, I was surprised too.. --- vendor/clink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 3c4ee42..f7b5056 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -129,7 +129,7 @@ local function set_prompt_filter() if env ~= nil then env = "("..env..") " else env = "" end - prompt = get_uah_color() .. "{uah}" .. get_cwd_color() .. "{cwd}{git}{hg}{svn}" .. get_lamb_color() .. cr .. "{lamb} \x1b[0m" + prompt = get_uah_color() .. "{uah}" .. get_cwd_color() .. "{cwd}{git}{hg}{svn}" .. get_lamb_color() .. cr .. "{env}{lamb} \x1b[0m" prompt = string.gsub(prompt, "{uah}", uah) prompt = string.gsub(prompt, "{cwd}", cwd) prompt = string.gsub(prompt, "{env}", env) From c2629348225654af723600e8b7088e8ebe05aaa0 Mon Sep 17 00:00:00 2001 From: Ian Craig Date: Thu, 20 May 2021 17:53:05 -0700 Subject: [PATCH 300/371] Add branchonly option to cmdstatus --- README.md | 9 +++-- vendor/clink.lua | 53 ++++++++++++++++---------- vendor/cmder_prompt_config.lua.default | 1 + 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b6e18c0..a419f5b 100644 --- a/README.md +++ b/README.md @@ -194,10 +194,11 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t ``` [cmder] - status = false # Opt out of Git status for 'ALL' Cmder supported shells. - cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells. - psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells. - shstatus = false # Opt out of Git status for 'bash.exe' shells. + status = false # Opt out of Git status for 'ALL' Cmder supported shells. + cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells. + cmdstatus = branchonly # Show branch name in 'Cmd.exe' shells, but don't color according to status (faster) + psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells. + shstatus = false # Opt out of Git status for 'bash.exe' shells. ``` ### Aliases diff --git a/vendor/clink.lua b/vendor/clink.lua index 3c4ee42..a05858d 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -41,6 +41,10 @@ local function get_conflict_color() return conflict_color or "\x1b[31;1m" end +local function get_unknown_color() + return unknown_color or "\x1b[30;1m" +end + --- -- Makes a string safe to use as the replacement in string.gsub --- @@ -361,27 +365,29 @@ end --- -- Get the status of working dir --- @return {bool} +-- @return {bool|'branchonly'} --- local function get_git_status_setting() - local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul") + local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul") + for line in gitCmdStatusConfig:lines() do + if string.match(line, 'false') then + gitCmdStatusConfig:close() + return false + elseif string.match(line, 'branchonly') then + gitCmdStatusConfig:close() + return 'branchonly' + end + end + gitCmdStatusConfig:close() + local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul") for line in gitStatusConfig:lines() do if string.match(line, 'false') then gitStatusConfig:close() return false end end - - local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul") - for line in gitCmdStatusConfig:lines() do - if string.match(line, 'false') then - gitCmdStatusConfig:close() - return false - end - end gitStatusConfig:close() - gitCmdStatusConfig:close() return true end @@ -392,7 +398,8 @@ local function git_prompt_filter() local colors = { clean = get_clean_color(), dirty = get_dirty_color(), - conflict = get_conflict_color() + conflict = get_conflict_color(), + unknown = get_unknown_color() } local git_dir = get_git_dir() @@ -403,17 +410,21 @@ local function git_prompt_filter() local branch = get_git_branch(git_dir) local color if branch then - -- Has branch => therefore it is a git folder, now figure out status - local gitStatus = get_git_status() - local gitConflict = get_git_conflict() + if cmderGitStatusOptIn ~= 'branchonly' then + -- Has branch => therefore it is a git folder, now figure out status + local gitStatus = get_git_status() + local gitConflict = get_git_conflict() - color = colors.dirty - if gitStatus then - color = colors.clean - end + color = colors.dirty + if gitStatus then + color = colors.clean + end - if gitConflict then - color = colors.conflict + if gitConflict then + color = colors.conflict + end + else + color = colors.unknown end clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 5e59c14..5b3068d 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -43,3 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color clean_color = "\x1b[1;37;40m" dirty_color = "\x1b[33;3m" conflict_color = "\x1b[31;1m" +unknown_color = "\x1b[30;1m" From 9df8f1a92ad9b02b851410e0c6aa42aab144ea35 Mon Sep 17 00:00:00 2001 From: Ian Craig Date: Tue, 25 May 2021 17:53:41 -0700 Subject: [PATCH 301/371] Revert to boolean, keep branch name when status=false --- README.md | 9 ++++----- vendor/clink.lua | 49 ++++++++++++++++++++++-------------------------- 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index a419f5b..b6e18c0 100644 --- a/README.md +++ b/README.md @@ -194,11 +194,10 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t ``` [cmder] - status = false # Opt out of Git status for 'ALL' Cmder supported shells. - cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells. - cmdstatus = branchonly # Show branch name in 'Cmd.exe' shells, but don't color according to status (faster) - psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells. - shstatus = false # Opt out of Git status for 'bash.exe' shells. + status = false # Opt out of Git status for 'ALL' Cmder supported shells. + cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells. + psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells. + shstatus = false # Opt out of Git status for 'bash.exe' shells. ``` ### Aliases diff --git a/vendor/clink.lua b/vendor/clink.lua index a05858d..4f12c6c 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -365,29 +365,27 @@ end --- -- Get the status of working dir --- @return {bool|'branchonly'} +-- @return {bool} --- local function get_git_status_setting() - local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul") - for line in gitCmdStatusConfig:lines() do - if string.match(line, 'false') then - gitCmdStatusConfig:close() - return false - elseif string.match(line, 'branchonly') then - gitCmdStatusConfig:close() - return 'branchonly' - end - end - gitCmdStatusConfig:close() - local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul") + for line in gitStatusConfig:lines() do if string.match(line, 'false') then gitStatusConfig:close() return false end end + + local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul") + for line in gitCmdStatusConfig:lines() do + if string.match(line, 'false') then + gitCmdStatusConfig:close() + return false + end + end gitStatusConfig:close() + gitCmdStatusConfig:close() return true end @@ -404,13 +402,13 @@ local function git_prompt_filter() local git_dir = get_git_dir() cmderGitStatusOptIn = get_git_status_setting() - if cmderGitStatusOptIn then - if git_dir then - -- if we're inside of git repo then try to detect current branch - local branch = get_git_branch(git_dir) - local color - if branch then - if cmderGitStatusOptIn ~= 'branchonly' then + + if git_dir then + -- if we're inside of git repo then try to detect current branch + local branch = get_git_branch(git_dir) + local color = colors.unknown + if branch then + if cmderGitStatusOptIn then -- Has branch => therefore it is a git folder, now figure out status local gitStatus = get_git_status() local gitConflict = get_git_conflict() @@ -423,14 +421,11 @@ local function git_prompt_filter() if gitConflict then color = colors.conflict end - else - color = colors.unknown - end + end - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") - return false - end - end + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") + return false + end end -- No git present or not in git file From a5c98d4fe92800a5f819c3f9393848311d908f88 Mon Sep 17 00:00:00 2001 From: Ian Craig Date: Tue, 25 May 2021 21:03:28 -0700 Subject: [PATCH 302/371] Add simple branch name gen for sh and ps1 --- vendor/git-prompt.sh | 18 ++++++++++++++++++ vendor/psmodules/Cmder.ps1 | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/vendor/git-prompt.sh b/vendor/git-prompt.sh index c41a5a1..ccda575 100644 --- a/vendor/git-prompt.sh +++ b/vendor/git-prompt.sh @@ -9,6 +9,21 @@ function getGitStatusSetting() { fi } +function getSimpleGitBranch() { + gitDir=$(git rev-parse --git-dir 2>/dev/null) + if [ -z "$gitDir" ]; then + return 0 + fi + + headContent=$(< "$gitDir/HEAD") + if [[ "$headContent" == "ref: refs/heads/"* ]] + then + echo " (${headContent:16})" + else + echo " (HEAD detached at ${headContent:0:7})" + fi +} + if test -f /etc/profile.d/git-sdk.sh then TITLEPREFIX=SDK-${MSYSTEM#MINGW} @@ -45,6 +60,9 @@ else . "$COMPLETION_PATH/git-prompt.sh" PS1="$PS1"'\[\033[36m\]' # change color to cyan PS1="$PS1"'`__git_ps1`' # bash function + else + PS1="$PS1"'\[\033[30;1m\]' # change color to gray + PS1="$PS1"'`getSimpleGitBranch`' fi fi fi diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index 86dfb02..5ede0cf 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -36,6 +36,14 @@ function checkGit($Path) { if (getGitStatusSetting -eq $true) { Write-VcsStatus + } else { + $headContent = Get-Content (Join-Path $Path '.git/HEAD') + if ($headContent -like "ref: refs/heads/*") { + $branchName = $headContent.Substring(16) + } else { + $branchName = "HEAD detached at $($headContent.Substring(0, 7))" + } + Write-Host " [$branchName]" -NoNewline -ForegroundColor DarkGray } return From 03d0f913ea2dad4596640313a36833a260b8a222 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 07:27:16 -0400 Subject: [PATCH 303/371] fixing branch only --- vendor/clink.lua | 14 ++++++++++++++ vendor/cmder_prompt_config.lua.default | 1 + 2 files changed, 15 insertions(+) diff --git a/vendor/clink.lua b/vendor/clink.lua index c01d6be..2c26d4c 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -350,6 +350,7 @@ local function git_prompt_filter() clean = clean_color, dirty = dirty_color, conflict = conflict_color + nostatus = unknown_color } local git_dir = get_git_dir() @@ -377,6 +378,17 @@ local function git_prompt_filter() return false end end + else + if git_dir then + local branch = get_git_branch(git_dir) + local color + if branch then + color = colors.nostatus + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") + return false + end + end + end -- No git present or not in git file @@ -394,6 +406,7 @@ local function hg_prompt_filter() local colors = { clean = clean_color, dirty = dirty_color, + nostatus = nostatus_color } local pipe = io.popen("hg branch 2>&1") @@ -428,6 +441,7 @@ local function svn_prompt_filter() local colors = { clean = clean_color, dirty = dirty_color, + nostatus = nostatus_color } if get_svn_dir() then diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 5e59c14..366dc62 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -43,3 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color clean_color = "\x1b[1;37;40m" dirty_color = "\x1b[33;3m" conflict_color = "\x1b[31;1m" +unknown_color = "\x1b[1;30;40m" -- Light Grey = No VCS Status Branch Color From c9acb13d0b0f8871b2ea6ea8716a820e8eaa2d60 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 07:50:48 -0400 Subject: [PATCH 304/371] Fix cmder no status prompt --- CHANGELOG.md | 2 + vendor/clink.lua | 84 ++++++++++++++++++++------ vendor/cmder_prompt_config.lua.default | 2 +- vendor/sources.json | 4 +- 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc61977..77d2fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ### Changes - Update Git for Windows to 2.31.1 +- Update to Clink 1.2.5 +- Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` ### Adds diff --git a/vendor/clink.lua b/vendor/clink.lua index 2c26d4c..d69d4e2 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -13,6 +13,38 @@ dofile(clink_lua_file) -- now add our own things... + +local function get_uah_color() + return uah_color or "\x1b[1;33;40m" -- Green = uah = [user]@[hostname] +end + +local function get_cwd_color() + return cwd_color or "\x1b[1;32;40m" -- Yellow cwd = Current Working Directory +end + +local function get_lamb_color() + return lamb_color or "\x1b[1;30;40m" -- Light Grey = Lambda Color +end + + +local function get_clean_color() + return clean_color or "\x1b[1;37;40m" +end + + +local function get_dirty_color() + return dirty_color or "\x1b[33;3m" +end + + +local function get_conflict_color() + return conflict_color or "\x1b[31;1m" +end + +local function get_unknown_color() + return unknown_color or "\x1b[1;37;40m" +end + --- -- Makes a string safe to use as the replacement in string.gsub --- @@ -65,6 +97,22 @@ local function set_prompt_filter() prompt_lambSymbol = "λ" end + if not prompt_type then + prompt_type = "full" + end + + if prompt_useHomeSymbol == nil then + prompt_useHomeSymbol = false + end + + if prompt_useUserAtHost == nil then + prompt_useUserAtHost = false + end + + if prompt_singleLine == nil then + prompt_singleLine = false + end + if prompt_type == 'folder' then cwd = get_folder_name(cwd) end @@ -83,14 +131,13 @@ local function set_prompt_filter() cr = ' ' end - if env ~= nil then - prompt_lambSymbol = "("..env..") "..prompt_lambSymbol - end + if env ~= nil then env = "("..env..") " else env = "" end - prompt = uah_color .. "{uah}" .. cwd_color .. "{cwd}{git}{hg}{svn}" .. lamb_color .. cr .. "{lamb} \x1b[0m" - uah_value = string.gsub(prompt, "{uah}", uah) - new_value = string.gsub(uah_value, "{cwd}", cwd) - clink.prompt.value = string.gsub(new_value, "{lamb}", prompt_lambSymbol) + prompt = get_uah_color() .. "{uah}" .. get_cwd_color() .. "{cwd}{git}{hg}{svn}" .. get_lamb_color() .. cr .. "{lamb} \x1b[0m" + prompt = string.gsub(prompt, "{uah}", uah) + prompt = string.gsub(prompt, "{cwd}", cwd) + prompt = string.gsub(prompt, "{env}", env) + clink.prompt.value = string.gsub(prompt, "{lamb}", prompt_lambSymbol) end local function percent_prompt_filter() @@ -347,19 +394,19 @@ local function git_prompt_filter() -- Colors for git status local colors = { - clean = clean_color, - dirty = dirty_color, - conflict = conflict_color - nostatus = unknown_color + clean = get_clean_color(), + dirty = get_dirty_color(), + conflict = get_conflict_color(), + nostatus = get_unknown_color() } local git_dir = get_git_dir() + local color cmderGitStatusOptIn = get_git_status_setting() if cmderGitStatusOptIn then if git_dir then -- if we're inside of git repo then try to detect current branch local branch = get_git_branch(git_dir) - local color if branch then -- Has branch => therefore it is a git folder, now figure out status local gitStatus = get_git_status() @@ -381,7 +428,6 @@ local function git_prompt_filter() else if git_dir then local branch = get_git_branch(git_dir) - local color if branch then color = colors.nostatus clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") @@ -404,9 +450,9 @@ local function hg_prompt_filter() if hg_dir then -- Colors for mercurial status local colors = { - clean = clean_color, - dirty = dirty_color, - nostatus = nostatus_color + clean = get_clean_color(), + dirty = get_dirty_color(), + nostatus = get_unknown_color() } local pipe = io.popen("hg branch 2>&1") @@ -439,9 +485,9 @@ end local function svn_prompt_filter() -- Colors for svn status local colors = { - clean = clean_color, - dirty = dirty_color, - nostatus = nostatus_color + clean = get_clean_color(), + dirty = get_dirty_color(), + nostatus = get_unknown_color() } if get_svn_dir() then diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 366dc62..ab3191f 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -43,4 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color clean_color = "\x1b[1;37;40m" dirty_color = "\x1b[33;3m" conflict_color = "\x1b[31;1m" -unknown_color = "\x1b[1;30;40m" -- Light Grey = No VCS Status Branch Color +unknown_color = "\x1b[1;37;40m" -- White = No VCS Status Branch Color diff --git a/vendor/sources.json b/vendor/sources.json index b552653..f2423a4 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.1.45", - "url": "https://github.com/chrisant996/clink/releases/download/v1.1.45/clink.1.1.45.1c3985.zip" + "version": "1.2.5", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.5/clink.1.2.5.5dd017.zip" }, { "name": "conemu-maximus5", From 4fab4cc6e4fba06f4a8cf13a74afcf2e112fd6e1 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 08:41:40 -0400 Subject: [PATCH 305/371] make unknown color white for all shells --- vendor/git-prompt.sh | 2 +- vendor/psmodules/Cmder.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/git-prompt.sh b/vendor/git-prompt.sh index ccda575..957dcdc 100644 --- a/vendor/git-prompt.sh +++ b/vendor/git-prompt.sh @@ -61,7 +61,7 @@ else PS1="$PS1"'\[\033[36m\]' # change color to cyan PS1="$PS1"'`__git_ps1`' # bash function else - PS1="$PS1"'\[\033[30;1m\]' # change color to gray + PS1="$PS1"'\[\033[37;1m\]' # change color to white PS1="$PS1"'`getSimpleGitBranch`' fi fi diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index 5ede0cf..755d4a7 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -43,7 +43,7 @@ function checkGit($Path) { } else { $branchName = "HEAD detached at $($headContent.Substring(0, 7))" } - Write-Host " [$branchName]" -NoNewline -ForegroundColor DarkGray + Write-Host " [$branchName]" -NoNewline -ForegroundColor White } return From 73ad62eaa2c08c9e7ae0192e9139676566523a34 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 08:46:08 -0400 Subject: [PATCH 306/371] add xxx --- xxx | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 xxx diff --git a/xxx b/xxx new file mode 100644 index 0000000..e69de29 From 413fb2f1ac9ad18785cae2b745bc4919dfe7a678 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 08:46:37 -0400 Subject: [PATCH 307/371] remove xxx --- xxx | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 xxx diff --git a/xxx b/xxx deleted file mode 100644 index e69de29..0000000 From aebe37bd282afb361dff54601a056168deab0278 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 08:56:05 -0400 Subject: [PATCH 308/371] fix default unknown color --- vendor/clink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 5bf3612..89550c4 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -42,7 +42,7 @@ local function get_conflict_color() end local function get_unknown_color() - return unknown_color or "\x1b[1;37;40m" + return unknown_color or "\x1b[37;1m" end --- From 55ff6110952dde45ee561f1e30d4c2778cb019b0 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 30 May 2021 08:56:44 -0400 Subject: [PATCH 309/371] fix default unknown color --- vendor/cmder_prompt_config.lua.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index ab3191f..a33de81 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -43,4 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color clean_color = "\x1b[1;37;40m" dirty_color = "\x1b[33;3m" conflict_color = "\x1b[31;1m" -unknown_color = "\x1b[1;37;40m" -- White = No VCS Status Branch Color +unknown_color = "\x1b[37;1" -- White = No VCS Status Branch Color From 56b04fc9ce252c4c1e45023db81c17e667377aba Mon Sep 17 00:00:00 2001 From: dgames Date: Mon, 31 May 2021 10:53:18 -0400 Subject: [PATCH 310/371] fix unknown color and code dedup --- vendor/clink.lua | 50 +++++++++++--------------- vendor/cmder_prompt_config.lua.default | 2 +- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 89550c4..2110548 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -403,37 +403,29 @@ local function git_prompt_filter() local git_dir = get_git_dir() local color cmderGitStatusOptIn = get_git_status_setting() - if cmderGitStatusOptIn then - if git_dir then - -- if we're inside of git repo then try to detect current branch - local branch = get_git_branch(git_dir) - if branch then - -- Has branch => therefore it is a git folder, now figure out status - local gitStatus = get_git_status() - local gitConflict = get_git_conflict() + if git_dir then + local branch = get_git_branch(git_dir) + if branch then + if cmderGitStatusOptIn then + -- if we're inside of git repo then try to detect current branch + -- Has branch => therefore it is a git folder, now figure out status + local gitStatus = get_git_status() + local gitConflict = get_git_conflict() - color = colors.dirty - if gitStatus then - color = colors.clean - end + color = colors.dirty + if gitStatus then + color = colors.clean + end - if gitConflict then - color = colors.conflict - end - - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") - return false - end - end - else - if git_dir then - local branch = get_git_branch(git_dir) - if branch then - color = colors.nostatus - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") - return false - end - end + if gitConflict then + color = colors.conflict + end + else + color = colors.nostatus + end + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") + return false + end end -- No git present or not in git file diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index a33de81..e5ae224 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -43,4 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color clean_color = "\x1b[1;37;40m" dirty_color = "\x1b[33;3m" conflict_color = "\x1b[31;1m" -unknown_color = "\x1b[37;1" -- White = No VCS Status Branch Color +unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color From 5305ebd4a6679ef2fe75dbb6fcaaecdc274a4d0f Mon Sep 17 00:00:00 2001 From: Chris Antos Date: Mon, 31 May 2021 21:29:19 -0700 Subject: [PATCH 311/371] Use Clink async prompt filtering for git. `git status` and `git diff` can be slow in large repos. Clink v1.2.10 and higher support using Lua coroutines to do expensive parts of prompt filtering in the background. When the expensive parts complete, the prompt gets refreshed. This means even large repos can have fast prompts PLUS git status all the time! This change should be backward/forward compatible with both older and newer versions of Clink (of course only newer versions will gain the benefit). --- vendor/clink.lua | 63 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 2110548..7fbf55a 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -63,6 +63,28 @@ local function get_folder_name(path) end +--- +-- Forward/backward compatibility for Clink asynchronous prompt filtering. +-- With Clink v1.2.10 and higher this lets git status run in the background and +-- refresh the prompt when it finishes, to eliminate waits in large git repos. +--- +local io_popenyield +local clink_promptcoroutine +local cached_info = {} +if clink.promptcoroutine and io.popenyield then + io_popenyield = io.popenyield + clink_promptcoroutine = clink.promptcoroutine + -- Uncommenting this will override the cmderGitStatusOptIn and always show + -- git status when Clink is able to run it in the background. + --cmderForceAsyncGitStatus = true +else + io_popenyield = io.popen + clink_promptcoroutine = function (func) + return func(false) + end +end + + --- -- Setting the prompt in clink means that commands which rewrite the prompt do -- not destroy our own prompt. It also means that started cmds (or batch files @@ -308,7 +330,7 @@ end -- @return {bool} --- local function get_git_status() - local file = io.popen("git --no-optional-locks status --porcelain 2>nul") + local file = io_popenyield("git --no-optional-locks status --porcelain 2>nul") for line in file:lines() do file:close() return false @@ -323,7 +345,7 @@ end -- @return {bool} indicating true for conflict, false for no conflicts --- function get_git_conflict() - local file = io.popen("git diff --name-only --diff-filter=U 2>nul") + local file = io_popenyield("git diff --name-only --diff-filter=U 2>nul") for line in file:lines() do file:close() return true; @@ -363,6 +385,22 @@ local function get_svn_status() return true end +--- +-- Use a prompt coroutine to get git status in the background. +-- Cache the info so we can reuse it next time to reduce flicker. +--- +local function get_git_info_table() + local info = clink_promptcoroutine(function () + return { status=get_git_status(), conflict=get_git_conflict() } + end) + if not info then + info = cached_info.git_info or {} + else + cached_info.git_info = info + end + return info +end + --- -- Get the status of working dir -- @return {bool} @@ -402,19 +440,30 @@ local function git_prompt_filter() local git_dir = get_git_dir() local color - cmderGitStatusOptIn = get_git_status_setting() + cmderGitStatusOptIn = cmderForceAsyncGitStatus or get_git_status_setting() if git_dir then local branch = get_git_branch(git_dir) if branch then + -- If in a different repo or branch than last time, discard cached info. + if cached_info.git_dir ~= git_dir or cached_info.git_branch ~= branch then + cached_info.git_info = nil + cached_info.git_dir = git_dir + cached_info.git_branch = branch + end + -- Use git status if allowed. if cmderGitStatusOptIn then -- if we're inside of git repo then try to detect current branch -- Has branch => therefore it is a git folder, now figure out status - local gitStatus = get_git_status() - local gitConflict = get_git_conflict() + local gitInfo = get_git_info_table() + local gitStatus = gitInfo.status + local gitConflict = gitInfo.conflict - color = colors.dirty - if gitStatus then + if gitStatus == nil then + color = colors.nostatus + elseif gitStatus then color = colors.clean + else + color = colors.dirty end if gitConflict then From b2add2b966ef4e6008ddd8f0a5ce13d1491f053d Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 10 Jun 2021 20:12:47 -0400 Subject: [PATCH 312/371] prompt config docs --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index b6e18c0..592c19e 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,26 @@ echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh You may find some Monokai color schemes for mintty to match Cmder [here](https://github.com/oumu/mintty-color-schemes/blob/master/base16-monokai-mod.minttyrc). +### Changing Cmder Default `cmd.exe` Prompt Config File + +The default Cmder shell `cmd::Cmder` propmt is customized using `Clink` and is configured by editing a config file that exists in one of two locations: + +- Single User Portable Config `%CMDER_ROOT%\config\cmder_prompt_config.lua` +- Shared Cmder install with Non-Portable Individual User Config `%CMDER_USER_CONFIG%\cmder_prompt_config.lua` + +If your Cmder setup does not have this file create it from `%CMDER_ROOT%\vendor\cmder_prompt_config.lua.default` + +Customizations include: + +- Colors. +- Single/Multi-line. +- Full path/Folder only. +- `[user]@[host]` to the beginning of the prompt. +- `~` for home directory. +- `λ` symbol + +Documentation is in the file for each setting. + ### Changing Cmder Default `cmd.exe` Shell Startup Behaviour Using Task Arguments 1. Press Win + Alt + T From bfe526604dab46edbcd4faa7eaffbd4aaee385dc Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 10 Jun 2021 20:21:43 -0400 Subject: [PATCH 313/371] revert --- vendor/cmder_prompt_config.lua.default | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 366dc62..5e59c14 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -43,4 +43,3 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color clean_color = "\x1b[1;37;40m" dirty_color = "\x1b[33;3m" conflict_color = "\x1b[31;1m" -unknown_color = "\x1b[1;30;40m" -- Light Grey = No VCS Status Branch Color From 91aabe75af71e8621cba50dc5d1f64bff127acfd Mon Sep 17 00:00:00 2001 From: Chris Antos Date: Thu, 10 Jun 2021 18:49:39 -0700 Subject: [PATCH 314/371] Add prompt config variable for async git prompt. Setting `prompt_overrideGitStatusOptIn = true` will override the `cmder.status` and `cmder.cmdstatus` git config settings and run the git prompt status commands in the background. But it only takes effect when using Clink v1.2.10, since that's required in order to run prompt update commands in the background. --- vendor/clink.lua | 6 +++--- vendor/cmder_prompt_config.lua.default | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 7fbf55a..3bd5b72 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -74,9 +74,9 @@ local cached_info = {} if clink.promptcoroutine and io.popenyield then io_popenyield = io.popenyield clink_promptcoroutine = clink.promptcoroutine - -- Uncommenting this will override the cmderGitStatusOptIn and always show - -- git status when Clink is able to run it in the background. - --cmderForceAsyncGitStatus = true + if prompt_overrideGitStatusOptIn then + cmderForceAsyncGitStatus = true + end else io_popenyield = io.popen clink_promptcoroutine = function (func) diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index e5ae224..045a0d7 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -29,6 +29,11 @@ prompt_useUserAtHost = false -- default is false prompt_singleLine = false +-- OPTIONAL. If true then always ignore the cmder.status and cmder.cmdstatus git config settings and run the git prompt commands in the background. + -- default is false + -- NOTE: This only takes effect if using Clink v1.2.10 or higher. +prompt_overrideGitStatusOptIn = false + -- Prompt Attributes -- -- Colors From f6c2657b23204e4c0ba5d6f875280b3cee287ab3 Mon Sep 17 00:00:00 2001 From: Chris Antos Date: Fri, 11 Jun 2021 01:01:35 -0700 Subject: [PATCH 315/371] Allow scripts to disable part of the Cmder prompt. The Cmder prompt normally includes version control info, which involves running some potentially expensive commands. The cmder-powerline-prompt project (and maybe other projects) replaces the Cmder prompt and runs the same potentially expensive commands -- so expensive commands get run twice! This change makes it possible for the user and/or other scripts to disable the version control part of the built-in Cmder prompt. https://github.com/chrisant996/cmder-powerline-prompt --- vendor/clink.lua | 34 +++++++++++++++++++++++++- vendor/cmder_prompt_config.lua.default | 4 +++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 3bd5b72..5f3b628 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -85,6 +85,13 @@ else end +--- +-- Global variable so other Lua scripts can detect whether they're in a Cmder +-- shell session. +--- +CMDER_SESSION = true + + --- -- Setting the prompt in clink means that commands which rewrite the prompt do -- not destroy our own prompt. It also means that started cmds (or batch files @@ -135,6 +142,10 @@ local function set_prompt_filter() prompt_singleLine = false end + if prompt_includeVersionControl == nil then + prompt_includeVersionControl = true + end + if prompt_type == 'folder' then cwd = get_folder_name(cwd) end @@ -155,7 +166,12 @@ local function set_prompt_filter() if env ~= nil then env = "("..env..") " else env = "" end - prompt = get_uah_color() .. "{uah}" .. get_cwd_color() .. "{cwd}{git}{hg}{svn}" .. get_lamb_color() .. cr .. "{lamb} \x1b[0m" + if uah ~= '' then uah = get_uah_color() .. uah end + if cwd ~= '' then cwd = get_cwd_color() .. cwd end + + local version_control = prompt_includeVersionControl and "{git}{hg}{svn}" or "" + + prompt = "{uah}{cwd}" .. version_control .. get_lamb_color() .. cr .. "{lamb} \x1b[0m" prompt = string.gsub(prompt, "{uah}", uah) prompt = string.gsub(prompt, "{cwd}", cwd) prompt = string.gsub(prompt, "{env}", env) @@ -430,6 +446,11 @@ end local function git_prompt_filter() + -- Don't do any git processing if the prompt doesn't want to show git info. + if not clink.prompt.value:find("{git}") then + return false + end + -- Colors for git status local colors = { clean = get_clean_color(), @@ -484,6 +505,11 @@ end local function hg_prompt_filter() + -- Don't do any hg processing if the prompt doesn't want to show hg info. + if not clink.prompt.value:find("{hg}") then + return false + end + local result = "" local hg_dir = get_hg_dir() @@ -523,6 +549,12 @@ local function hg_prompt_filter() end local function svn_prompt_filter() + + -- Don't do any svn processing if the prompt doesn't want to show svn info. + if not clink.prompt.value:find("{svn}") then + return false + end + -- Colors for svn status local colors = { clean = get_clean_color(), diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 045a0d7..6847f25 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -34,6 +34,10 @@ prompt_singleLine = false -- NOTE: This only takes effect if using Clink v1.2.10 or higher. prompt_overrideGitStatusOptIn = false +-- OPTIONAL. If true then Cmder includes git, mercurial, and subversion status in the prompt. + -- default is true +prompt_includeVersionControl = true + -- Prompt Attributes -- -- Colors From e7a6e6447384921a49cf707225177a5f55a3d6ed Mon Sep 17 00:00:00 2001 From: Chris Antos Date: Sat, 12 Jun 2021 18:56:37 -0700 Subject: [PATCH 316/371] Rewrote how `prompt_overrideGitStatusOptIn` works. It was less clear before, and it also accidentally took effect when the `prompt.async` Clink setting was off. --- vendor/clink.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 5f3b628..f7931ad 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -74,9 +74,6 @@ local cached_info = {} if clink.promptcoroutine and io.popenyield then io_popenyield = io.popenyield clink_promptcoroutine = clink.promptcoroutine - if prompt_overrideGitStatusOptIn then - cmderForceAsyncGitStatus = true - end else io_popenyield = io.popen clink_promptcoroutine = function (func) @@ -422,6 +419,15 @@ end -- @return {bool} --- local function get_git_status_setting() + -- When async prompt filtering is available, check the + -- prompt_overrideGitStatusOptIn config setting for whether to ignore the + -- cmder.status and cmder.cmdstatus git config opt-in settings. + if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") then + if prompt_overrideGitStatusOptIn then + return true + end + end + local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul") for line in gitStatusConfig:lines() do @@ -461,7 +467,7 @@ local function git_prompt_filter() local git_dir = get_git_dir() local color - cmderGitStatusOptIn = cmderForceAsyncGitStatus or get_git_status_setting() + cmderGitStatusOptIn = get_git_status_setting() if git_dir then local branch = get_git_branch(git_dir) if branch then From 9d4da6318493e5d0c4f62f8d2202e8ef04cf467b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Benoit?= Date: Mon, 12 Jul 2021 11:07:31 +0200 Subject: [PATCH 317/371] Update clink to 1.2.20 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index f2423a4..f4d7e2e 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.2.5", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.5/clink.1.2.5.5dd017.zip" + "version": "1.2.20", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.20/clink.1.2.20.801802.zip" }, { "name": "conemu-maximus5", From ae7209f2545e424a6b584bc56914b787e526c85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Benoit?= Date: Fri, 16 Jul 2021 08:43:52 +0200 Subject: [PATCH 318/371] Update clink to 1.2.22 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index f4d7e2e..d7fd186 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.2.20", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.20/clink.1.2.20.801802.zip" + "version": "1.2.22", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.22/clink.1.2.22.890a84.zip" }, { "name": "conemu-maximus5", From 48f50568b08b52da701beb9a935d14bd073648e7 Mon Sep 17 00:00:00 2001 From: dgames Date: Fri, 23 Jul 2021 23:09:24 -0400 Subject: [PATCH 319/371] update conemu and clink --- vendor/sources.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index d7fd186..3eb61d6 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,13 +6,13 @@ }, { "name": "clink", - "version": "1.2.22", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.22/clink.1.2.22.890a84.zip" + "version": "1.2.23", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.23/clink.1.2.23.9b90e7.zip" }, { "name": "conemu-maximus5", - "version": "210304", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.03.04/ConEmuPack.210304.7z" + "version": "210718", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.07.18/ConEmuPack.210718.7z" }, { "name": "clink-completions", From 0fc6b6571e37310838ce81b71bc020c4c7c8ebff Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 7 Aug 2021 03:25:34 -0400 Subject: [PATCH 320/371] update clink to 1.2.24 --- .gitignore | 1 + CHANGELOG.md | 3 ++- vendor/sources.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 67678bb..771fd1a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ vendor/*/* !vendor/lib/* !vendor/* !vendor/psmodules/* +vendor/git-for-windows config/* !config/Readme.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 77d2fdb..0c1dd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ ### Changes - Update Git for Windows to 2.31.1 -- Update to Clink 1.2.5 +- Update to Clink 1.2.24 +- Update to Conemu 210718 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` ### Adds diff --git a/vendor/sources.json b/vendor/sources.json index 3eb61d6..0fd613e 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -7,7 +7,7 @@ { "name": "clink", "version": "1.2.23", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.23/clink.1.2.23.9b90e7.zip" + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.23/clink.1.2.24.3a07c0.zip" }, { "name": "conemu-maximus5", From 710cc3ecc3c1ff9de20a30a7664a1df82c03b3fb Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 7 Aug 2021 03:27:13 -0400 Subject: [PATCH 321/371] update clink to 1.2.24 --- vendor/sources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/sources.json b/vendor/sources.json index 0fd613e..bf02ed6 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,7 +6,7 @@ }, { "name": "clink", - "version": "1.2.23", + "version": "1.2.24", "url": "https://github.com/chrisant996/clink/releases/download/v1.2.23/clink.1.2.24.3a07c0.zip" }, { From f717f5031ba86e1d4af7ec8df048923f0873be71 Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 7 Aug 2021 03:30:40 -0400 Subject: [PATCH 322/371] update clink to 1.2.24 --- vendor/sources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/sources.json b/vendor/sources.json index bf02ed6..372972f 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -7,7 +7,7 @@ { "name": "clink", "version": "1.2.24", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.23/clink.1.2.24.3a07c0.zip" + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.24/clink.1.2.24.3a07c0_setup.exe" }, { "name": "conemu-maximus5", From b885b4e235e3df465d929440b784740045d548ed Mon Sep 17 00:00:00 2001 From: dgames Date: Fri, 13 Aug 2021 21:36:58 -0400 Subject: [PATCH 323/371] Clink 1.2.26 --- CHANGELOG.md | 2 +- vendor/git-for-windows_1.29.1 | 1 + vendor/sources.json | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 120000 vendor/git-for-windows_1.29.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c1dd53..26aeaf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Changes - Update Git for Windows to 2.31.1 -- Update to Clink 1.2.24 +- Update to Clink 1.2.26 - Update to Conemu 210718 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` diff --git a/vendor/git-for-windows_1.29.1 b/vendor/git-for-windows_1.29.1 new file mode 120000 index 0000000..5f898e1 --- /dev/null +++ b/vendor/git-for-windows_1.29.1 @@ -0,0 +1 @@ +../../../dtgam/bin/git-2.29.0 \ No newline at end of file diff --git a/vendor/sources.json b/vendor/sources.json index 372972f..b7f55a2 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.2.24", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.24/clink.1.2.24.3a07c0_setup.exe" + "version": "1.2.26", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.26/clink.1.2.26.3dc58b.zip" }, { "name": "conemu-maximus5", From 2ef8c967d2dd203869c411ca56bddfad6d505855 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 19 Aug 2021 11:47:47 -0400 Subject: [PATCH 324/371] update conemu and clink (#2575) * update conemu and clink * update clink to 1.2.24 * update clink to 1.2.24 * update clink to 1.2.24 * Clink 1.2.26 Co-authored-by: dgames --- .gitignore | 1 + CHANGELOG.md | 3 ++- vendor/git-for-windows_1.29.1 | 1 + vendor/sources.json | 8 ++++---- 4 files changed, 8 insertions(+), 5 deletions(-) create mode 120000 vendor/git-for-windows_1.29.1 diff --git a/.gitignore b/.gitignore index 67678bb..771fd1a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ vendor/*/* !vendor/lib/* !vendor/* !vendor/psmodules/* +vendor/git-for-windows config/* !config/Readme.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 77d2fdb..26aeaf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ ### Changes - Update Git for Windows to 2.31.1 -- Update to Clink 1.2.5 +- Update to Clink 1.2.26 +- Update to Conemu 210718 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` ### Adds diff --git a/vendor/git-for-windows_1.29.1 b/vendor/git-for-windows_1.29.1 new file mode 120000 index 0000000..5f898e1 --- /dev/null +++ b/vendor/git-for-windows_1.29.1 @@ -0,0 +1 @@ +../../../dtgam/bin/git-2.29.0 \ No newline at end of file diff --git a/vendor/sources.json b/vendor/sources.json index d7fd186..b7f55a2 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,13 +6,13 @@ }, { "name": "clink", - "version": "1.2.22", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.22/clink.1.2.22.890a84.zip" + "version": "1.2.26", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.26/clink.1.2.26.3dc58b.zip" }, { "name": "conemu-maximus5", - "version": "210304", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.03.04/ConEmuPack.210304.7z" + "version": "210718", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.07.18/ConEmuPack.210718.7z" }, { "name": "clink-completions", From 6d1e2d6e8bc67481f29fde9ee5928dfcd5e67ecf Mon Sep 17 00:00:00 2001 From: Aleksandar Kocic Date: Tue, 31 Aug 2021 08:40:46 +0200 Subject: [PATCH 325/371] Fix Posh-Git 1.0.0 import and console. --- vendor/psmodules/Cmder.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index 755d4a7..59eae1e 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -21,6 +21,10 @@ function Import-Git(){ if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ Import-Module Posh-Git > $null } + if($GitModule | select version | where version -ge ([version]"1.0.0")){ + Import-Module Posh-Git > $null + $GitPromptSettings.AnsiConsole = $false + } if(-not ($GitModule) ) { Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder." } From f809af1eec2280e5ed6de7f195ed00bd6e6862da Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 17 Sep 2021 12:22:25 -0400 Subject: [PATCH 326/371] save cmder_diag.* output to a file --- vendor/bin/cmder_diag.cmd | 50 +++++++++++++-------- vendor/bin/cmder_diag.ps1 | 95 +++++++++++++++++++++++---------------- vendor/bin/cmder_diag.sh | 66 ++++++++++++++++----------- 3 files changed, 130 insertions(+), 81 deletions(-) diff --git a/vendor/bin/cmder_diag.cmd b/vendor/bin/cmder_diag.cmd index 66f41a1..f526cff 100644 --- a/vendor/bin/cmder_diag.cmd +++ b/vendor/bin/cmder_diag.cmd @@ -1,5 +1,29 @@ @echo off +(echo. +echo ------------------------------------ +echo set +echo ------------------------------------ +set + +echo. +echo ------------------------------------ +echo where git +echo ------------------------------------ +where git + +echo. +echo ------------------------------------ +echo where clink +echo ------------------------------------ +where clink + +echo. +echo ------------------------------------ +echo systeminfo +echo ------------------------------------ +systeminfo + echo ------------------------------------ echo dir "%cmder_root%" echo ------------------------------------ @@ -23,25 +47,15 @@ echo dir /s "%cmder_root%\config" echo ------------------------------------ dir /s "%cmder_root%\config" -echo. -echo ------------------------------------ -echo set -echo ------------------------------------ -set - -echo. -echo ------------------------------------ -echo where git -echo ------------------------------------ -where git - -echo. -echo ------------------------------------ -echo systeminfo -echo ------------------------------------ -systeminfo - echo. echo ------------------------------------ echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! echo ------------------------------------ +) > "%temp%\cmder_diag_cmd.log" + +type "%temp%\cmder_diag_cmd.log" + +echo. +echo Above output was saved in "%temp%\cmder_diag_cmd.log" + + diff --git a/vendor/bin/cmder_diag.ps1 b/vendor/bin/cmder_diag.ps1 index f6ff930..45cb4b9 100644 --- a/vendor/bin/cmder_diag.ps1 +++ b/vendor/bin/cmder_diag.ps1 @@ -1,45 +1,64 @@ -write-host ------------------------------------ -write-host get-childitem "$env:CMDER_ROOT" -write-host ------------------------------------ -get-childitem "$env:CMDER_ROOT" +if (test-path $env:temp/cmder_diag_ps.log) { + remove-item $env:temp/cmder_diag_ps.log +} -write-host '' -write-host ------------------------------------ -write-host get-childitem "$env:CMDER_ROOT/vendor" -write-host ------------------------------------ -get-childitem "$env:CMDER_ROOT/vendor" +$cmder_diag = { +"" +"------------------------------------" +"get-childitem env:" +"------------------------------------" +get-childitem env: | ft -autosize -wrap 2>&1 -write-host '' -write-host ------------------------------------ -write-host get-childitem -s "$env:CMDER_ROOT/bin" -write-host ------------------------------------ -get-childitem -s "$env:CMDER_ROOT/bin" +"" +"------------------------------------" +"get-command git -all -ErrorAction SilentlyContinue" +"------------------------------------" +get-command git -all -ErrorAction SilentlyContinue -write-host '' -write-host ------------------------------------ -write-host get-childitem -s "$env:CMDER_ROOT/config" -write-host ------------------------------------ -get-childitem -s "$env:CMDER_ROOT/config" +"" +"------------------------------------" +"get-command clink -all -ErrorAction SilentlyContinue" +"------------------------------------" +get-command clink -all -ErrorAction SilentlyContinue -write-host '' -write-host ------------------------------------ -write-host get-childitem env: -write-host ------------------------------------ -get-childitem env: |ft -autosize -wrap +"" +"------------------------------------" +"systeminfo" +"------------------------------------" +systeminfo 2>&1 -write-host '' -write-host ------------------------------------ -write-host get-command git -write-host ------------------------------------ -get-command git +"------------------------------------" +"get-childitem '$env:CMDER_ROOT'" +"------------------------------------" +get-childitem "$env:CMDER_ROOT" |ft LastWriteTime,mode,length,FullName -write-host '' -write-host ------------------------------------ -write-host systeminfo -write-host ------------------------------------ -systeminfo +"" +"------------------------------------" +"get-childitem '$env:CMDER_ROOT/vendor'" +"------------------------------------" +get-childitem "$env:CMDER_ROOT/vendor" |ft LastWriteTime,mode,length,FullName -write-host '' -write-host ------------------------------------ -write-host Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! -write-host ------------------------------------ +"" +"------------------------------------" +"get-childitem -s '$env:CMDER_ROOT/bin'" +"------------------------------------" +get-childitem -s "$env:CMDER_ROOT/bin" |ft LastWriteTime,mode,length,FullName + +"" +"------------------------------------" +"get-childitem -s '$env:CMDER_ROOT/config'" +"------------------------------------" +get-childitem -s "$env:CMDER_ROOT/config" |ft LastWriteTime,mode,length,FullName + +"" +"------------------------------------" +"Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team!" +"------------------------------------" +} + +& $cmder_diag | out-file -filePath $env:temp/cmder_diag_ps.log + +get-content "$env:temp/cmder_diag_ps.log" + +write-host "" +write-host Above output was saved in "$env:temp/cmder_diag_ps.log" diff --git a/vendor/bin/cmder_diag.sh b/vendor/bin/cmder_diag.sh index fa49445..993c366 100644 --- a/vendor/bin/cmder_diag.sh +++ b/vendor/bin/cmder_diag.sh @@ -1,45 +1,61 @@ -echo ------------------------------------ -echo ls -la "$CMDER_ROOT" -echo ------------------------------------ -ls -la "$CMDER_ROOT" +#!/usr/bin/env bash -echo '' -echo ------------------------------------ -echo ls -la "$CMDER_ROOT/vendor" -echo ------------------------------------ -ls -la "$CMDER_ROOT/vendor" +[[ -f "$TEMP/cmder_diag_sh.log" ]] && rm -f "$TEMP/cmder_diag_sh.log" -echo '' -echo ------------------------------------ -echo ls -la /s "$CMDER_ROOT/bin" -echo ------------------------------------ -ls -laR /s "$CMDER_ROOT/bin" - -echo '' -echo ------------------------------------ -echo ls -la /s "$CMDER_ROOT/config" -echo ------------------------------------ -ls -laR /s "$CMDER_ROOT/config" - -echo '' +(echo '' echo ------------------------------------ echo env echo ------------------------------------ -env +env 2>&1 echo '' echo ------------------------------------ echo which git echo ------------------------------------ +which git 2>&1 + +echo '' +echo ------------------------------------ +echo which clink +echo ------------------------------------ +which clink 2>&1 -which git echo '' echo ------------------------------------ echo systeminfo echo ------------------------------------ -systeminfo +systeminfo 2>&1 + +echo ------------------------------------ +echo ls -la "$CMDER_ROOT" +echo ------------------------------------ +ls -la "$CMDER_ROOT" 2>&1 + +echo '' +echo ------------------------------------ +echo ls -la "$CMDER_ROOT/vendor" +echo ------------------------------------ +ls -la "$CMDER_ROOT/vendor" 2>&1 + +echo '' +echo ------------------------------------ +echo ls -la /s "$CMDER_ROOT/bin" +echo ------------------------------------ +ls -laR /s "$CMDER_ROOT/bin" 2>&1 + +echo '' +echo ------------------------------------ +echo ls -la /s "$CMDER_ROOT/config" +echo ------------------------------------ +ls -laR /s "$CMDER_ROOT/config" 2>&1 echo '' echo ------------------------------------ echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team! echo ------------------------------------ +) > "$TEMP/cmder_diag_sh.log" + +cat "$TEMP/cmder_diag_sh.log" + +echo '' +echo Above output was saved in "$TEMP/cmder_diag_sh.log" From fc6cf025bea350f0f5dfbdfb2515b643d9f44eb4 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 17 Sep 2021 12:28:49 -0400 Subject: [PATCH 327/371] save cmder_diag.* output to a file --- vendor/bin/cmder_diag.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendor/bin/cmder_diag.ps1 b/vendor/bin/cmder_diag.ps1 index 45cb4b9..e4ddb16 100644 --- a/vendor/bin/cmder_diag.ps1 +++ b/vendor/bin/cmder_diag.ps1 @@ -1,5 +1,5 @@ -if (test-path $env:temp/cmder_diag_ps.log) { - remove-item $env:temp/cmder_diag_ps.log +if (test-path $env:temp\cmder_diag_ps.log) { + remove-item $env:temp\cmder_diag_ps.log } $cmder_diag = { @@ -56,9 +56,9 @@ get-childitem -s "$env:CMDER_ROOT/config" |ft LastWriteTime,mode,length,FullName "------------------------------------" } -& $cmder_diag | out-file -filePath $env:temp/cmder_diag_ps.log +& $cmder_diag | out-file -filePath $env:temp\cmder_diag_ps.log -get-content "$env:temp/cmder_diag_ps.log" +get-content "$env:temp\cmder_diag_ps.log" write-host "" -write-host Above output was saved in "$env:temp/cmder_diag_ps.log" +write-host Above output was saved in "$env:temp\cmder_diag_ps.log" From c75c02c9ce676643dd44004b3e6d7867530600f1 Mon Sep 17 00:00:00 2001 From: dgames Date: Wed, 20 Oct 2021 21:10:38 -0400 Subject: [PATCH 328/371] update Clink and Conemu versions --- vendor/sources.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index b7f55a2..397c479 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,13 +6,13 @@ }, { "name": "clink", - "version": "1.2.26", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.26/clink.1.2.26.3dc58b.zip" + "version": "1.2.32", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.32/clink.1.2.32.510fbd.zip" }, { "name": "conemu-maximus5", - "version": "210718", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.07.18/ConEmuPack.210718.7z" + "version": "210912", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.09.12/ConEmuPack.210912.7z" }, { "name": "clink-completions", From 4c85e8b2f12842212c6f1d2dcdd2ab9e6d466827 Mon Sep 17 00:00:00 2001 From: Andrey Luzhin <62383996+xpam-net@users.noreply.github.com> Date: Fri, 29 Oct 2021 09:13:35 +0200 Subject: [PATCH 329/371] Fix a problem with an ampersand character in path If the path variable contained values with an ampersand character (such as in the case of MySQL), the string splits by this character, and tries to execute what follows as a separate command. All occurrences of the set command containing %PATH% should be wrapped in quotation marks --- vendor/lib/lib_path.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 725b549..3a807ad 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -74,7 +74,7 @@ exit /b set "find_query=%add_to_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" - set OLD_PATH=%PATH% + set "OLD_PATH=%PATH%" setlocal enabledelayedexpansion if "!found!" == "0" ( @@ -121,8 +121,8 @@ exit /b exit /b :toolong - echo %OLD_PATH%>tempfileA - echo %PATH%>tempfileB + echo "%OLD_PATH%">tempfileA + echo "%PATH%">tempfileB fc /b tempfileA tempfileB 2>nul 1>nul if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) del tempfileA & del tempfileB From c27cedc9b3e7d9e0673d90d0c449d50b74eaa983 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 7 Nov 2021 10:54:33 -0500 Subject: [PATCH 330/371] quote PATH settings --- vendor/cmder.sh | 6 +++--- vendor/lib/lib_path.cmd | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index 7ccddcf..4074346 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -42,10 +42,10 @@ elif [ -d "${CMDER_ROOT}/vendor/git-for-windows" ] ; then fi if [[ ! "$PATH" =~ "${GIT_INSTALL_ROOT}/bin:" ]] ; then - PATH=${GIT_INSTALL_ROOT}/bin:$PATH + PATH="${GIT_INSTALL_ROOT}/bin:$PATH" fi -PATH=${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT} +PATH="${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT}" export PATH @@ -80,7 +80,7 @@ if [ "${CMDER_USER_CONFIG}" != "" ] ; then mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" fi - export PATH=${CMDER_USER_CONFIG}/bin:$PATH + export PATH="${CMDER_USER_CONFIG}/bin:$PATH" CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 725b549..5788c35 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -74,7 +74,7 @@ exit /b set "find_query=%add_to_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" - set OLD_PATH=%PATH% + set "OLD_PATH=%PATH%" setlocal enabledelayedexpansion if "!found!" == "0" ( From f24266014f01458408670eac7d917a9e57f25b2c Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 7 Nov 2021 13:03:44 -0500 Subject: [PATCH 331/371] update clink and git --- CHANGELOG.md | 6 +++--- vendor/sources.json | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26aeaf3..a944d2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,9 @@ ### Changes -- Update Git for Windows to 2.31.1 -- Update to Clink 1.2.26 -- Update to Conemu 210718 +- Update Git for Windows to 2.33.1 +- Update to Clink 1.2.41 +- Update to Conemu 210912 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` ### Adds diff --git a/vendor/sources.json b/vendor/sources.json index 397c479..9e59eff 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,13 +1,13 @@ [ { "name": "git-for-windows", - "version": "v2.31.1.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.31.1.windows.1/PortableGit-2.31.1-64-bit.7z.exe" + "version": "v2.33.1.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.33.1.windows.1/PortableGit-2.33.1-64-bit.7z.exe" }, { "name": "clink", - "version": "1.2.32", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.32/clink.1.2.32.510fbd.zip" + "version": "1.2.41", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.41/clink.1.2.41.647c1b.zip" }, { "name": "conemu-maximus5", From addcefdd47a9584cc78646e5b1087c31b4a27542 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 7 Nov 2021 15:16:32 +0100 Subject: [PATCH 332/371] Speed up git status / conflict status by calling git only once. --- vendor/clink.lua | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index f7931ad..ca8d5dc 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -339,32 +339,27 @@ local function get_svn_branch(svn_dir) end --- --- Get the status of working dir --- @return {bool} +-- Get the status and conflict status of working dir +-- @return {bool , bool } --- local function get_git_status() local file = io_popenyield("git --no-optional-locks status --porcelain 2>nul") + local conflict_found = false + local is_status = true for line in file:lines() do - file:close() - return false + local code = line:sub(1, 2) + -- print (string.format("code: %s, line: %s", code, line)) + if code == "DD" or code == "AU" or code == "UD" or code == "UA" or code == "DU" or code == "AA" or code == "UU" then + is_status = false + conflict_found = true + break + -- unversioned files are ignored, comment out 'code ~= "!!"' to unignore them + elseif code ~= "!!" and code ~= "??" then + is_status = false + end end file:close() - - return true -end - ---- --- Gets the conflict status --- @return {bool} indicating true for conflict, false for no conflicts ---- -function get_git_conflict() - local file = io_popenyield("git diff --name-only --diff-filter=U 2>nul") - for line in file:lines() do - file:close() - return true; - end - file:close() - return false + return { status = is_status, conflict = conflict_found } end @@ -404,7 +399,7 @@ end --- local function get_git_info_table() local info = clink_promptcoroutine(function () - return { status=get_git_status(), conflict=get_git_conflict() } + return get_git_status() end) if not info then info = cached_info.git_info or {} From 59dfa9c46f8ef06a3c0327042fcd139f4ff7578d Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Thu, 11 Nov 2021 07:35:04 -0500 Subject: [PATCH 333/371] Revert "Fix a problem with an ampersand character in path" --- vendor/lib/lib_path.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 3a807ad..725b549 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -74,7 +74,7 @@ exit /b set "find_query=%add_to_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" - set "OLD_PATH=%PATH%" + set OLD_PATH=%PATH% setlocal enabledelayedexpansion if "!found!" == "0" ( @@ -121,8 +121,8 @@ exit /b exit /b :toolong - echo "%OLD_PATH%">tempfileA - echo "%PATH%">tempfileB + echo %OLD_PATH%>tempfileA + echo %PATH%>tempfileB fc /b tempfileA tempfileB 2>nul 1>nul if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) del tempfileA & del tempfileB From 9f065a63e8e9c134e35d4f12ecce23f24c34793c Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Tue, 16 Nov 2021 09:22:17 -0500 Subject: [PATCH 334/371] Ps1 git discovery (#2438) * Fix start errors in path with () * Fix start errors in path with () * Fix start errors in path with () * Fix start errors in path with () * remove quotes from debug_output messages * remove quotes from debug_output messages * remove quotes from debug_output messages * discovery newer git version * new git path config for powershell * xxx * add isGitShim * fix no git found in path * debug * revert not ps1 changes * cleanup * final * spacing * fixes * cleanup * cleanup * timer for Powershell * fixes * fixes for git path settings * grab vendor/bin/alias.cmd from master Co-authored-by: Dax T. Games Co-authored-by: dgames --- vendor/profile.ps1 | 51 +++++++++++++-- vendor/psmodules/Cmder.ps1 | 127 +++++++++++++++++++++++++++++++++---- 2 files changed, 158 insertions(+), 20 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index ad9182a..ea3df01 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -3,6 +3,7 @@ # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED # !!! Use "%CMDER_ROOT%\config\user_profile.ps1" to add your own startup commands +$CMDER_INIT_START=$(Get-Date -UFormat %s) # Compatibility with PS major versions <= 2 if(!$PSScriptRoot) { @@ -39,13 +40,48 @@ if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderMod $env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;") } -try { - # Check if git is on PATH, i.e. Git already installed on system - Get-command -Name "git" -ErrorAction Stop >$null -} catch { - if (test-path "$env:CMDER_ROOT\vendor\git-for-windows") { - Configure-Git "$env:CMDER_ROOT\vendor\git-for-windows" +$gitVersionVendor = (readVersion -gitPath "$ENV:CMDER_ROOT\vendor\git-for-windows\cmd") +# write-host "GIT VENDOR: ${gitVersionVendor}" + +# Get user installed Git Version[s] and Compare with vendored if found. +foreach ($git in (get-command -ErrorAction SilentlyContinue -all 'git')) { + # write-host "GIT Path: " + $git.Path + $gitDir = Split-Path -Path $git.Path + $gitDir = isGitShim -gitPath $gitDir + $gitVersionUser = (readVersion -gitPath $gitDir) + # write-host "GIT USER: ${gitVersionUser}" + + $useGitVersion = compare_git_versions -userVersion $gitVersionUser -vendorVersion $gitVersionVendor + # write-host "Using GIT Version: ${useGitVersion}" + + # Use user installed Git + if ($gitPathUser -eq $null) { + if ($gitDir -match '\\mingw32\\bin' -or $gitDir -match '\\mingw64\\bin') { + $gitPathUser = ($gitDir.subString(0,$gitDir.Length - 12)) + } else { + $gitPathUser = ($gitDir.subString(0,$gitDir.Length - 4)) + } } + + if ($useGitVersion -eq $gitVersionUser) { + # write-host "Using GIT Dir: ${gitDir}" + $ENV:GIT_INSTALL_ROOT = $gitPathUser + $ENV:GIT_INSTALL_TYPE = 'USER' + break + } +} + +# User vendored Git. +if ($ENV:GIT_INSTALL_ROOT -eq $null -and $gitVersionVendor -ne $null) { + $ENV:GIT_INSTALL_ROOT = "$ENV:CMDER_ROOT\vendor\git-for-windows" + $ENV:GIT_INSTALL_TYPE = 'VENDOR' +} + +# write-host "GIT_INSTALL_ROOT: ${ENV:GIT_INSTALL_ROOT}" +# write-host "GIT_INSTALL_TYPE: ${ENV:GIT_INSTALL_TYPE}" + +if (-not($ENV:GIT_INSTALL_ROOT -eq $null)) { + $env:Path = Configure-Git -gitRoot "$ENV:GIT_INSTALL_ROOT" -gitType $ENV:GIT_INSTALL_TYPE -gitPathUser $gitPathUser } if ( Get-command -Name "vim" -ErrorAction silentlycontinue) { @@ -177,3 +213,6 @@ if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionS # if (!$(get-command Prompt).Options -match 'ReadOnly') {Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly} Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly } + +$CMDER_INIT_END=$(Get-Date -UFormat %s) +# write-host "Elapsed Time: $(get-Date) `($($CMDER_INIT_END - $CMDER_INIT_START) total`)" diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index 59eae1e..eb782e5 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -1,18 +1,117 @@ -function Configure-Git($GIT_INSTALL_ROOT){ - $env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd") +function readVersion($gitPath) { + $gitExecutable = "${gitPath}\git.exe" - # Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already - $GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\') - if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" - } + if (!(test-path "$gitExecutable")) { + return $null + } - # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already - if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" - } elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin" - } + $gitVersion = (cmd /c "${gitExecutable}" --version) + + if ($gitVersion -match 'git version') { + ($trash1, $trash2, $gitVersion) = $gitVersion.split(' ', 3) + } else { + pause + return $null + } + + return $gitVersion.toString() +} + +function isGitShim($gitPath) { + # check if there's shim - and if yes follow the path + + if (test-path "${gitPath}\git.shim") { + $shim = (get-content "${gitPath}\git.shim") + ($trash, $gitPath) = $shim.replace(' ','').split('=') + + $gitPath=$gitPath.replace('\git.exe','') + } + + return $gitPath.toString() +} + +function compareVersions($userVersion, $vendorVersion) { + if (-not($userVersion -eq $null)) { + ($userMajor, $userMinor, $userPatch, $userBuild) = $userVersion.split('.', 4) + } else { + return -1 + } + + if (-not($vendorVersion -eq $null)) { + ($vendorMajor, $vendorMinor, $vendorPatch, $vendorBuild) = $vendorVersion.split('.', 4) + } else { + return 1 + } + + if (($userMajor -eq $vendorMajor) -and ($userMinor -eq $vendorMinor) -and ($userPatch -eq $vendorPatch) -and ($userBuild -eq $vendorBuild)) { + return 1 + } + + if ($userMajor -gt $vendorMajor) {return 1} + if ($userMajor -lt $vendorMajor) {return -1} + + if ($userMinor -gt $vendorMinor) {return 1} + if ($userMinor -lt $vendorMinor) {return -1} + + if ($userPatch -gt $vendorPatch) {return 1} + if ($userPatch -lt $vendorPatch) {return -1} + + if ($userBuild -gt $vendorBuild) {return 1} + if ($userBuild -lt $vendorBuild) {return -1} + + return 0 +} + +function compare_git_versions($userVersion, $vendorVersion) { + $result = compareVersions -userVersion $userVersion -vendorVersion $vendorVersion + + # write-host "Compare Versions Result: ${result}" + if ($result -ge 0) { + return $userVersion + } else { + return $vendorVersion + } +} + +function Configure-Git($gitRoot, $gitType, $gitPathUser){ + # Proposed Behavior + + # Modify the path if we are using VENDORED Git do nothing if using USER Git. + # If User Git is installed but older match its path config adding paths + # in the same path positions allowing a user to configure Cmder Git path + # using locally installed Git Path Config. + if ($gitType -eq 'VENDOR') { + # If User Git is installed replace its path config with Newer Vendored Git Path + if ($gitPathUser -ne '' -and $gitPathUser -ne $null) { + write-host -foregroundcolor yellow "Cmder 'profile.ps1': Replacing older user Git path '$gitPathUser' with newer vendored Git path '$gitRoot' in the system path..." + + $newPath = ($env:path -ireplace [regex]::Escape($gitPathUser), $gitRoot) + } else { + if (!($env:Path -match [regex]::Escape("$gitRoot\cmd"))) { + # write-host "Adding $gitRoot\cmd to the path" + $newPath = $($gitRoot + "\cmd" + ";" + $env:Path) + } + + # Add "$gitRoot\mingw[32|64]\bin" to the path if exists and not done already + if ((test-path "$gitRoot\mingw32\bin") -and -not ($env:path -match [regex]::Escape("$gitRoot\mingw32\bin"))) { + # write-host "Adding $gitRoot\mingw32\bin to the path" + $newPath = "$newPath;$gitRoot\mingw32\bin" + } elseif ((test-path "$gitRoot\mingw64\bin") -and -not ($env:path -match [regex]::Escape("$gitRoot\mingw64\bin"))) { + # write-host "Adding $gitRoot\mingw64\bin to the path" + $newPath = "$newPath;$gitRoot\mingw64\bin" + } + + # Add "$gitRoot\usr\bin" to the path if exists and not done already + if ((test-path "$gitRoot\usr\bin") -and -not ($env:path -match [regex]::Escape("$gitRoot\usr\bin"))) { + # write-host "Adding $gitRoot\usr\bin to the path" + $newPath = "$newPath;$gitRoot\usr\bin" + } + } + + return $newPath + } + + return $env:path } function Import-Git(){ @@ -32,7 +131,7 @@ function Import-Git(){ return $true } -function checkGit($Path) { +function checkGit($Path) { if (Test-Path -Path (Join-Path $Path '.git') ) { if($env:gitLoaded -eq 'false') { $env:gitLoaded = Import-Git From 6ae2f97f524b7f034267fb1fd990c3cfc189cc07 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 21 Nov 2021 13:32:57 -0500 Subject: [PATCH 335/371] add quotes --- vendor/lib/lib_path.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 5788c35..3a807ad 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -121,8 +121,8 @@ exit /b exit /b :toolong - echo %OLD_PATH%>tempfileA - echo %PATH%>tempfileB + echo "%OLD_PATH%">tempfileA + echo "%PATH%">tempfileB fc /b tempfileA tempfileB 2>nul 1>nul if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) del tempfileA & del tempfileB From 004535e0bc6e333a4b50643d627acdab9f8ce9ce Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 21 Nov 2021 13:40:53 -0500 Subject: [PATCH 336/371] remove -all --- CHANGELOG.md | 12 ++++++++++++ vendor/profile.ps1 | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a944d2c..39a08a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,18 @@ ### Adds +- Powershell Git version Discovery - See #2373 for the full proposal. + - Find user installed Git on Path + - If found + - if newer than Cmder embedded Git + - Use it's existing Path config and completely ignore embedded Git. + - Else if Cmder embedded Git exists and is newer + - Match User installed Git path config using Cmder embedded Git folders. + - Else if Cmder embedded Git exists + - Add Cmder embedded Git folders to the path. + - `$env:cmder_root\vendor\git-for-windows\cmd;$env:path` + - `$env:path;$env:cmder_root\vendor\git-for-windows\usr\bin` + - `$env:path;$env:cmder_root\vendor\git-for-windows\mingw64\bin` - Configurable prompt for `cmd.exe` sessions. See `%cmder_root%\config\cmder_prompt_config.lua` - Configurable colors - Option to change `λ` to another character. diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index ea3df01..1472bc5 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -44,7 +44,7 @@ $gitVersionVendor = (readVersion -gitPath "$ENV:CMDER_ROOT\vendor\git-for-window # write-host "GIT VENDOR: ${gitVersionVendor}" # Get user installed Git Version[s] and Compare with vendored if found. -foreach ($git in (get-command -ErrorAction SilentlyContinue -all 'git')) { +foreach ($git in (get-command -ErrorAction SilentlyContinue 'git')) { # write-host "GIT Path: " + $git.Path $gitDir = Split-Path -Path $git.Path $gitDir = isGitShim -gitPath $gitDir From f39aade500acfc3e66afec06db228f4e22482f8a Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 21 Nov 2021 13:49:39 -0500 Subject: [PATCH 337/371] Update to Git 2.34.0and Clink 1.2.46 --- CHANGELOG.md | 6 +++--- vendor/sources.json | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a08a1..1f103e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,9 @@ ### Changes -- Update Git for Windows to 2.33.1 -- Update to Clink 1.2.41 -- Update to Conemu 210912 +- Update Git for Windows to 2.34.0 +- Update to Clink 1.2.46 +- Update to stable Conemu 210912 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` ### Adds diff --git a/vendor/sources.json b/vendor/sources.json index 9e59eff..f559553 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,13 +1,13 @@ [ { "name": "git-for-windows", - "version": "v2.33.1.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.33.1.windows.1/PortableGit-2.33.1-64-bit.7z.exe" + "version": "v2.34.0.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.34.0.windows.1/PortableGit-2.34.0-64-bit.7z.exe" }, { "name": "clink", - "version": "1.2.41", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.41/clink.1.2.41.647c1b.zip" + "version": "1.2.46", + "url": "https://github.com/chrisant996/clink/releases/download/v1.2.46/clink.1.2.46.69fc92.zip" }, { "name": "conemu-maximus5", From 8ea4bbb11c09ceab8f2b2deeecb3a8af3fc95e21 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Tue, 30 Nov 2021 20:34:31 +0900 Subject: [PATCH 338/371] Fix typo in README.md enviroment -> environment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 592c19e..a8b70a6 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,7 @@ If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_R Cmder is by default shipped with a vendored Git installation. On each instance of launching Cmder, an attempt is made to locate any other user provided Git binaries. Upon finding a `git.exe` binary, Cmder further compares its version against the vendored one _by executing_ it. The vendored `git.exe` binary is _only_ used when it is more recent than the user-installed one. -You may use your favorite version of Git by including its path in the `%PATH%` enviroment variable. Moreover, the **Mini** edition of Cmder (found on the [downloads page](https://github.com/cmderdev/cmder/releases)) excludes any vendored Git binaries. +You may use your favorite version of Git by including its path in the `%PATH%` environment variable. Moreover, the **Mini** edition of Cmder (found on the [downloads page](https://github.com/cmderdev/cmder/releases)) excludes any vendored Git binaries. ### Using external Cygwin/Babun, MSys2, WSL, or Git for Windows SDK with Cmder. From a1417f6cf93ed1ba8cbccd2ca19a7d3864308a63 Mon Sep 17 00:00:00 2001 From: Ihor Sofiichenko Date: Wed, 8 Dec 2021 23:49:14 +0200 Subject: [PATCH 339/371] Fix a problem with an ampersand character in path --- vendor/lib/lib_path.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 725b549..5788c35 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -74,7 +74,7 @@ exit /b set "find_query=%add_to_path%" set "find_query=%find_query:\=\\%" set "find_query=%find_query: =\ %" - set OLD_PATH=%PATH% + set "OLD_PATH=%PATH%" setlocal enabledelayedexpansion if "!found!" == "0" ( From 357e51acd1c9afa084509446de3363fc65819ad5 Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 15 Jan 2022 11:00:58 -0500 Subject: [PATCH 340/371] spelling fixes --- README.md | 10 +++++----- launcher/src/CmderLauncher.cpp | 2 +- scripts/utils.ps1 | 4 ++-- vendor/bin/alias.cmd | 4 ++-- vendor/bin/cexec.cmd | 10 +++++----- vendor/cmder_exinit | 2 +- vendor/init.bat | 2 +- vendor/lib/lib_git.cmd | 4 ++-- vendor/lib/lib_path.cmd | 2 +- vendor/profile.ps1 | 2 +- vendor/psmodules/PsGet/PsGet.psm1 | 16 ++++++++-------- vendor/user_profile.cmd.default | 2 +- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 592c19e..af3c913 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can | `/SINGLE` | Start Cmder in single mode. | | `/START [start_path]` | Folder path to start in. | | `/TASK [task_name]` | Task to start after launch. | -| `/X [ConEmu extras pars]` | Forwads parameters to ConEmu | +| `/X [ConEmu extras pars]` | Forwards parameters to ConEmu | ## Context Menu Integration @@ -138,7 +138,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/ ### Changing Cmder Default `cmd.exe` Prompt Config File -The default Cmder shell `cmd::Cmder` propmt is customized using `Clink` and is configured by editing a config file that exists in one of two locations: +The default Cmder shell `cmd::Cmder` prompt is customized using `Clink` and is configured by editing a config file that exists in one of two locations: - Single User Portable Config `%CMDER_ROOT%\config\cmder_prompt_config.lua` - Shared Cmder install with Non-Portable Individual User Config `%CMDER_USER_CONFIG%\cmder_prompt_config.lua` @@ -177,7 +177,7 @@ Documentation is in the file for each setting. | `/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 | -| `/t` | Enables Cmder Timed Init Mode. This displays the time taken run init scripts | not set | +| `/t` | Enables Cmder Timed Init Mode. This displays the time taken run init scripts | 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 | @@ -185,7 +185,7 @@ Documentation is in the file for each setting. | `/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 | +| (custom arguments) | User defined arguments processed by `cexec`. Type `cexec /?` for more usage. | 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: @@ -269,7 +269,7 @@ If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_R Cmder is by default shipped with a vendored Git installation. On each instance of launching Cmder, an attempt is made to locate any other user provided Git binaries. Upon finding a `git.exe` binary, Cmder further compares its version against the vendored one _by executing_ it. The vendored `git.exe` binary is _only_ used when it is more recent than the user-installed one. -You may use your favorite version of Git by including its path in the `%PATH%` enviroment variable. Moreover, the **Mini** edition of Cmder (found on the [downloads page](https://github.com/cmderdev/cmder/releases)) excludes any vendored Git binaries. +You may use your favorite version of Git by including its path in the `%PATH%` environment variable. Moreover, the **Mini** edition of Cmder (found on the [downloads page](https://github.com/cmderdev/cmder/releases)) excludes any vendored Git binaries. ### Using external Cygwin/Babun, MSys2, WSL, or Git for Windows SDK with Cmder. diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index 05d3f99..5d36566 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -250,7 +250,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr { MessageBox(NULL, (GetLastError() == ERROR_ACCESS_DENIED) - ? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." + ? L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied." : L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP); exit(1); } diff --git a/scripts/utils.ps1 b/scripts/utils.ps1 index fe5aa47..4447aec 100644 --- a/scripts/utils.ps1 +++ b/scripts/utils.ps1 @@ -31,7 +31,7 @@ function Extract-Archive($source, $target) { Write-Verbose $("Extracting Archive '$cmder_root\vendor\" + $source.replace('/','\') + " to '$cmder_root\vendor\$target'") Invoke-Expression "7z x -y -o`"$($target)`" `"$source`" > `$null" if ($lastexitcode -ne 0) { - Write-Error "Extracting of $source failied" + Write-Error "Extracting of $source failed" } Remove-Item $source } @@ -41,7 +41,7 @@ function Create-Archive($source, $target, $params) { Write-Verbose "Running: $command" Invoke-Expression $command if ($lastexitcode -ne 0) { - Write-Error "Compressing $source failied" + Write-Error "Compressing $source failed" } } diff --git a/vendor/bin/alias.cmd b/vendor/bin/alias.cmd index ac2525c..462131e 100644 --- a/vendor/bin/alias.cmd +++ b/vendor/bin/alias.cmd @@ -140,9 +140,9 @@ echo. in he alias is desired. Variables in aliases surrounded by double echo. quotes only require '^^%%' vs '^^^^^^^^%%' echo. $* - allows the alias to assume all the parameters of the supplied echo. command. -echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in +echo. $1-$9 - Allows you to separate parameter by number, much like %%1 in echo. batch. -echo. $T - Command seperator, allowing you to string several commands +echo. $T - Command separator, allowing you to string several commands echo. together into one alias. echo. echo. For more information, read DOSKEY /? diff --git a/vendor/bin/cexec.cmd b/vendor/bin/cexec.cmd index ee5efa8..755cfae 100644 --- a/vendor/bin/cexec.cmd +++ b/vendor/bin/cexec.cmd @@ -84,29 +84,29 @@ echo Usage: echo. echo cexec /setPath [NOT] flagName command/program [parameters] echo. -echo /setPath Generate a global varibles %%ccall%% and %%cexec%% for +echo /setPath Generate a global variables %%ccall%% and %%cexec%% for echo quicker use. Following arguments will be ignored. echo. echo NOT Specifies that cexec should carry out echo the command only if the flag is missing. echo. -echo /[flagName] Specifies which flag name is to detect. It's recommand +echo /[flagName] Specifies which flag name is to detect. It's recommended echo to use a pair of double quotation marks to wrap echo your flag name to avoid exceed expectation. echo. echo command/program Specifies the command to carry out if the -echo argument name is detected. It's recommand to +echo argument name is detected. It's recommended to echo use a pair of double quotation marks to echo wrap your command to avoid exceed expectation. echo. echo parameters These are the parameters passed to the command/program. -echo It's recommand to use a pair of double quotation marks +echo It's recommended to use a pair of double quotation marks echo to wrap your flag name to avoid exceed expectation. echo. echo Examples: echo. echo These examples are expected to be written in %cmder_root%/config/user-profile.cmd -echo CExec evaluates the environment varible "CMDER_USER_FLAGS" and conditionally +echo CExec evaluates the environment variable "CMDER_USER_FLAGS" and conditionally echo caries out actions based on flags that are passed. echo. echo Case 1: diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 095a1e9..4ec3351 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -10,7 +10,7 @@ # zsh - Copy to /etc/profile.d/cmder_exinit.zsh # Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh or # add whole config scripts to ${CMDER_ROOT}/config/profile.d both will be sourced -# from mthis file and be appied to the environment at startup. +# from this file and be applied to the environment at startup. # # These customizations will follow Cmder if $CMDER_ROOT is copied # to another machine. diff --git a/vendor/init.bat b/vendor/init.bat index 3b1bf6a..e5da902 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -131,7 +131,7 @@ goto var_loop if defined CMDER_USER_CONFIG ( %print_debug% init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" - if not exist "%CMDER_USER_CONFIG%\opt" md "%CMDER_USER_CONFIG%\opt" + if not exist "%CMDER_USER_CONFIG%\..\opt" md "%CMDER_USER_CONFIG%\..\opt" ) :: Pick right version of clink diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 3e095a6..19d2af7 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -14,7 +14,7 @@ exit /b :read_version :::=============================================================================== -:::read_version - Get the git.exe verion +:::read_version - Get the git.exe version :::. :::include: :::. @@ -54,7 +54,7 @@ exit /b if /i "%%A %%B" == "git version" ( set "GIT_VERSION=%%C" ) else ( - echo "'git --version' returned an inproper version string!" + echo "'git --version' returned an improper version string!" pause exit /b ) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 3a807ad..933d2f3 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -162,7 +162,7 @@ exit /b :::. :::options: :::. -::: [max_depth] Max recuse depth. Default: 1 +::: [max_depth] Max recursion depth. Default: 1 :::. ::: append Append instead to path env variable rather than pre-pend. :::. diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 1472bc5..23384c5 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -14,7 +14,7 @@ if ($ENV:CMDER_USER_CONFIG) { # write-host "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '$ENV:CMDER_USER_CONFIG'!" } -# We do this for Powershell as Admin Sessions because CMDER_ROOT is not beng set. +# We do this for Powershell as Admin Sessions because CMDER_ROOT is not being set. if (! $ENV:CMDER_ROOT ) { if ( $ENV:ConEmuDir ) { $ENV:CMDER_ROOT = resolve-path( $ENV:ConEmuDir + "\..\.." ) diff --git a/vendor/psmodules/PsGet/PsGet.psm1 b/vendor/psmodules/PsGet/PsGet.psm1 index ad3f886..b0094b9 100644 --- a/vendor/psmodules/PsGet/PsGet.psm1 +++ b/vendor/psmodules/PsGet/PsGet.psm1 @@ -124,7 +124,7 @@ Set-Variable -Name PSGET_PSD1 -Value 'PSD1' -Option Constant -Scope Script Description ----------- - Installs the module witout importing it to the current session + Installs the module without importing it to the current session .EXAMPLE # Install-Module PoshHg -AddToProfile @@ -448,7 +448,7 @@ function Update-Module { Description ----------- - Retrieves information about all registerd modules that starts with PoshCo. + Retrieves information about all registered modules that start with PoshCo. #> function Get-PsGetModuleInfo { [CmdletBinding()] @@ -694,7 +694,7 @@ function Install-ModuleFromDirectory { throw "Module $Module was not found in central repository" } - # $Module and $moduleData.Id are not equally by garantee, so we have to test again. + # $Module and $moduleData.Id are not equally by guarantee, so we have to test again. if (Test-ModuleInstalledAndImport -ModuleName:$moduleData.ModuleName -Destination:$Destination -Update:$Update -DoNotImport:$DoNotImport -ModuleHash:$ModuleHash) { return } @@ -1488,7 +1488,7 @@ function Invoke-DownloadModuleFromWeb { Install the module inside of the provided directory into the defined destination and perform the following steps: - * Rename module if requestes by provided InstallWithModuleName + * Rename module if requested by provided InstallWithModuleName * If a ModuleHash is provided, check if it matches. * Add the destination path to the PSModulePath if necessary (depends on provided parameters) * Place the conventions-matching module folder in the destination folder @@ -1796,9 +1796,9 @@ function Test-ModuleInstalledAndImport { <# .SYNOPSIS - Extract the content of the referenced zip file to the defind destination + Extract the content of the referenced zip file to the defined destination - .PARAMATER Path + .PARAMETER Path Path to a zip file with the file extension '.zip' .Parameter Destination @@ -1856,7 +1856,7 @@ function Expand-ZipModule { <# .SYNOPSIS - Update '$env:PSModulePath' from 'User' and 'Machine' scope envrionment variables + Update '$env:PSModulePath' from 'User' and 'Machine' scope environment variables #> function Update-PSModulePath { process { @@ -2152,4 +2152,4 @@ Export-ModuleMember TabExpansion Export-ModuleMember -Alias inmo Export-ModuleMember -Alias ismo Export-ModuleMember -Alias upmo -#endregion \ No newline at end of file +#endregion diff --git a/vendor/user_profile.cmd.default b/vendor/user_profile.cmd.default index e5966e0..00c7fb5 100644 --- a/vendor/user_profile.cmd.default +++ b/vendor/user_profile.cmd.default @@ -12,7 +12,7 @@ :: set "PATH=%CMDER_ROOT%\vendor\whatever;%PATH%" :: arguments in this batch are passed from init.bat, you can quickly parse them like so: -:: more useage can be seen by typing "cexec /?" +:: more usage can be seen by typing "cexec /?" :: %ccall% "/customOption" "command/program" From c51c3c55a8b75667b5dfe82671b23421fcefb60d Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 15 Jan 2022 11:12:38 -0500 Subject: [PATCH 341/371] add README config/profile.d --- .gitignore | 1 + config/profile.d/README.md | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 config/profile.d/README.md diff --git a/.gitignore b/.gitignore index 771fd1a..3431088 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ vendor/git-for-windows config/* !config/Readme.md +!config/profile.d/README.md config_user/* diff --git a/config/profile.d/README.md b/config/profile.d/README.md new file mode 100644 index 0000000..4883147 --- /dev/null +++ b/config/profile.d/README.md @@ -0,0 +1,3 @@ +## Profile.d Folder + +* Files in this folder named `*.{sh|cmd|ps1}`: Will be executed by the appropriate shell when starting the shell. From f997da60e3e678d930f6b99689d9a28f7642e608 Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 15 Jan 2022 11:20:33 -0500 Subject: [PATCH 342/371] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f103e3..30fc721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [Unreleased] +## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.19) (2022-01-15) ### Changes From 0281ee7dda4cc64bfbc273acbacd79abce7c401f Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 15 Jan 2022 11:22:00 -0500 Subject: [PATCH 343/371] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30fc721..c295f1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.19) (2022-01-15) +## [1.3.19](https://github.com/cmderdev/cmder/tree/v1.3.19) (2022-01-15) ### Changes From f0c4e85ac82222728a96102e648f74a6dae5bbfa Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 15 Jan 2022 15:14:24 -0500 Subject: [PATCH 344/371] yellow to white --- vendor/psmodules/Cmder.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index eb782e5..b23f1bb 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -83,7 +83,7 @@ function Configure-Git($gitRoot, $gitType, $gitPathUser){ if ($gitType -eq 'VENDOR') { # If User Git is installed replace its path config with Newer Vendored Git Path if ($gitPathUser -ne '' -and $gitPathUser -ne $null) { - write-host -foregroundcolor yellow "Cmder 'profile.ps1': Replacing older user Git path '$gitPathUser' with newer vendored Git path '$gitRoot' in the system path..." + write-host "Cmder 'profile.ps1': Replacing older user Git path '$gitPathUser' with newer vendored Git path '$gitRoot' in the system path..." $newPath = ($env:path -ireplace [regex]::Escape($gitPathUser), $gitRoot) } else { From 7cc1c772259aea05ce2d96367a46ac42e23d1175 Mon Sep 17 00:00:00 2001 From: dgames Date: Sat, 15 Jan 2022 16:02:14 -0500 Subject: [PATCH 345/371] do not display message when alterring git path --- vendor/psmodules/Cmder.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index b23f1bb..0c5a590 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -83,7 +83,7 @@ function Configure-Git($gitRoot, $gitType, $gitPathUser){ if ($gitType -eq 'VENDOR') { # If User Git is installed replace its path config with Newer Vendored Git Path if ($gitPathUser -ne '' -and $gitPathUser -ne $null) { - write-host "Cmder 'profile.ps1': Replacing older user Git path '$gitPathUser' with newer vendored Git path '$gitRoot' in the system path..." + # write-host "Cmder 'profile.ps1': Replacing older user Git path '$gitPathUser' with newer vendored Git path '$gitRoot' in the system path..." $newPath = ($env:path -ireplace [regex]::Escape($gitPathUser), $gitRoot) } else { @@ -115,7 +115,6 @@ function Configure-Git($gitRoot, $gitType, $gitPathUser){ } function Import-Git(){ - $GitModule = Get-Module -Name Posh-Git -ListAvailable if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ Import-Module Posh-Git > $null From eab4454ac588e241b864d8863f309c3fd63fc145 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Sat, 29 Jan 2022 14:48:58 +0000 Subject: [PATCH 346/371] Fix #2659: Use get_hg_branch() to get Mercurial branch information. --- vendor/clink.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 2d35e47..2cb362f 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -303,11 +303,18 @@ local function get_git_branch(git_dir) end --- --- Find out current branch --- @return {false|mercurial branch name} +-- Find out current branch information +-- @return {false|mercurial branch information} --- local function get_hg_branch() - local file = io.popen("hg branch 2>nul") + -- Return the branch information. The default is to get just the + -- branch name, but you could e.g. use the "hg-prompt" extension to + -- get more information, such as any applied mq patches. Here's an + -- example of that: + -- local cmd = "hg prompt \"{branch}{status}{|{patch}}{update}\"" + local cmd = "hg branch 2>nul" + local file = io.popen(cmd) + for line in file:lines() do local m = line:match("(.+)$") if m then @@ -521,10 +528,7 @@ local function hg_prompt_filter() dirty = get_dirty_color(), nostatus = get_unknown_color() } - - local pipe = io.popen("hg branch 2>&1") - local output = pipe:read('*all') - local rc = { pipe:close() } + local output = get_hg_branch() -- strip the trailing newline from the branch name local n = #output From 4098265a361af27bc52723d132a138a8f9ce6e26 Mon Sep 17 00:00:00 2001 From: Edouard Coissy Date: Wed, 2 Feb 2022 14:13:51 +0100 Subject: [PATCH 347/371] Fix #2654: blank space added between {cwd} and version_control variable --- vendor/clink.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 2d35e47..a2ff3a4 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -166,7 +166,7 @@ local function set_prompt_filter() if uah ~= '' then uah = get_uah_color() .. uah end if cwd ~= '' then cwd = get_cwd_color() .. cwd end - local version_control = prompt_includeVersionControl and "{git}{hg}{svn}" or "" + local version_control = prompt_includeVersionControl and " {git}{hg}{svn}" or "" prompt = "{uah}{cwd}" .. version_control .. get_lamb_color() .. cr .. "{env}{lamb} \x1b[0m" prompt = string.gsub(prompt, "{uah}", uah) From 6189f4f0e67e00cdfb2847ac1bf13bf43dae21b7 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 17 Mar 2022 07:57:48 -0400 Subject: [PATCH 348/371] fix prompt branch for git worktree --- vendor/clink.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vendor/clink.lua b/vendor/clink.lua index 956f5e9..d022238 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -256,6 +256,12 @@ local function get_git_dir(path) local git_dir = gitfile:read():match('gitdir: (.*)') gitfile:close() + if os.isdir then -- only available in Clink v1.0.0 and higher + if git_dir and os.isdir(git_dir) then + return git_dir + end + end + return git_dir and dir..'/'..git_dir end From 0dd2a665e2dfc3dd9c746001bc23031a14543678 Mon Sep 17 00:00:00 2001 From: dgames Date: Thu, 17 Mar 2022 08:10:18 -0400 Subject: [PATCH 349/371] CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c295f1d..e071c36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [Unreleased](https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts) (2022-03-17) + +### Changes + +- Fix Git prompt branch when using Git worktree. + ## [1.3.19](https://github.com/cmderdev/cmder/tree/v1.3.19) (2022-01-15) ### Changes From e345f187d840f3b0cfd55781d7695e36b6654551 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Sat, 16 Apr 2022 10:01:17 -0400 Subject: [PATCH 350/371] Remove set term=cygwin in init.bat (#2688) --- CHANGELOG.md | 5 +++++ vendor/init.bat | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e071c36..a987a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## [Unreleased](https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts) (2022-03-17) +### Fixes + +- Remove setting `term=cygwin` in `init.bat` to fix random `ABCD` characters when using arrow keys in `vim`. + - See: [Sometimes pressing on arrow keys prints symbols #1691](https://github.com/Maximus5/ConEmu/issues/169) + ### Changes - Fix Git prompt branch when using Git worktree. diff --git a/vendor/init.bat b/vendor/init.bat index e5da902..731b2eb 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -211,7 +211,6 @@ if "%CMDER_CONFIGURED%" GTR "1" ( :: I do not even know, copypasted from their .bat set PLINK_PROTOCOL=ssh -if not defined TERM set TERM=cygwin :: The idea: :: * if the users points as to a specific git, use that From ce02fb4a0e5761d9993f9adaea3f434cdb2b3fba Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Apr 2022 10:51:26 -0400 Subject: [PATCH 351/371] fix find latest git --- vendor/init.bat | 10 +++++----- vendor/lib/lib_git.cmd | 18 +++++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index e5da902..2ee6a59 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -222,7 +222,7 @@ 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" ( - %print_debug% "Skipping Git Auto-Detect!" + %print_debug% init.bat "Skipping Git Auto-Detect!" goto :VENDORED_GIT ) ) @@ -249,22 +249,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" - %print_debug% "Using vendored Git '%GIT_VERSION_VENDORED%'..." + %print_debug% init.bat "Using vendored Git '%GIT_VERSION_VENDORED%'..." goto :CONFIGURE_GIT ) else ( goto :NO_GIT ) :SPECIFIED_GIT -%print_debug% "Using /GIT_INSTALL_ROOT..." +%print_debug% init.bat "Using /GIT_INSTALL_ROOT..." goto :CONFIGURE_GIT :FOUND_GIT -%print_debug% "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." +%print_debug% init.bat "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..." goto :CONFIGURE_GIT :CONFIGURE_GIT -%print_debug% "Using Git from '%GIT_INSTALL_ROOT%..." +%print_debug% init.bat "Using Git from '%GIT_INSTALL_ROOT%..." :: Add git to the path if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" "" diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 19d2af7..eedef37 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -163,9 +163,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. - %print_debug% Comparing: - %print_debug% %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD% - %print_debug% %~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD% + %print_debug% ":compare_versions" "Comparing:" + %print_debug% ":compare_versions" "%~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%" + %print_debug% ":compare_versions" "%~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%" setlocal enabledelayedexpansion if !%~1_MAJOR! GTR !%~2_MAJOR! (endlocal & exit /b 1) @@ -233,23 +233,26 @@ exit /b setlocal enabledelayedexpansion if ERRORLEVEL 0 ( :: compare the user git version against the vendored version - !lib_git! compare_versions USER VENDORED + %lib_git% compare_versions USER VENDORED + set result=!ERRORLEVEL! + %print_debug% ":compare_git_versions" "campare versions_result: !result!" :: use the user provided git if its version is greater than, or equal to the vendored git - if ERRORLEVEL 0 ( + if !result! geq 0 ( if exist "!test_dir:~0,-4!\cmd\git.exe" ( set "GIT_INSTALL_ROOT=!test_dir:~0,-4!" ) else ( set "GIT_INSTALL_ROOT=!test_dir!" ) ) else ( - %print_verbose% "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." + %print_debug% ":compare_git_versions" "Found old !GIT_VERSION_USER! in !test_dir!, but not using..." ) ) else ( :: compare the user git version against the vendored version :: if the user provided git executable is not found IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( - %print_verbose% "No git at "!git_executable!" found." + :: if not exist "%git_executable%" ( + %print_debug% ":compare_git_versions" "No git at "%git_executable%" found." set test_dir= ) ) @@ -272,6 +275,7 @@ exit /b :get_user_git_version :: get the version information for the user provided git binary %lib_git% read_version USER "%test_dir%" 2>nul + %print_debug% ":get_user_git_version" "get_user_git_version GIT_VERSION_USER: %GIT_VERSION_USER%" %lib_git% validate_version USER %GIT_VERSION_USER% exit /b From 864b85f2549d42776bf1b870dfd835dc6e9e79dd Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Apr 2022 11:14:22 -0400 Subject: [PATCH 352/371] CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e071c36..c845a35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## [Unreleased](https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts) (2022-03-17) -### Changes +### Fixes +- Fix find and use latest Git install always using vendored Git. - Fix Git prompt branch when using Git worktree. ## [1.3.19](https://github.com/cmderdev/cmder/tree/v1.3.19) (2022-01-15) From 6d313853f3e3b6317b01867a654d4d2f73e88882 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Apr 2022 11:35:19 -0400 Subject: [PATCH 353/371] only look at \cmd\git.exe for found git --- vendor/init.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 2ee6a59..440cb9a 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -234,7 +234,7 @@ if defined GIT_INSTALL_ROOT ( %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 ( +for /F "delims=" %%F in ('where git.exe 2^>nul ^| find "\cmd\git.exe"') do ( :: get the absolute path to the user provided git binary %lib_git% is_git_shim "%%~dpF" %lib_git% get_user_git_version From 36e13027f64b0ec7969898c681fd85fd44eac91e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Apr 2022 11:42:27 -0400 Subject: [PATCH 354/371] CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3339c00..c6ca48a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Fixes +- Fix find and use latest Git install always using vendored Git. +- Fix using Git from vendored Git and other Git for Windows tools from other Git in path. - Remove setting `term=cygwin` in `init.bat` to fix random `ABCD` characters when using arrow keys in `vim`. - See: [Sometimes pressing on arrow keys prints symbols #1691](https://github.com/Maximus5/ConEmu/issues/169) - Fix Git prompt branch when using Git worktree. From fe294978786f303eff3702e35d58c13853367b77 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Apr 2022 13:36:24 -0400 Subject: [PATCH 355/371] update Clink to 1.3.14 --- CHANGELOG.md | 2 +- vendor/sources.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ca48a..2aeb8d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ ### Changes - Update Git for Windows to 2.34.0 -- Update to Clink 1.2.46 +- Update to Clink 1.3.14 - Update to stable Conemu 210912 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` diff --git a/vendor/sources.json b/vendor/sources.json index f559553..501d4f7 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.2.46", - "url": "https://github.com/chrisant996/clink/releases/download/v1.2.46/clink.1.2.46.69fc92.zip" + "version": "1.3.14", + "url": "https://github.com/chrisant996/clink/releases/download/v1.3.15/clink.1.3.15.6e6e45.zip" }, { "name": "conemu-maximus5", From 427937918ecbaa9c39708bc090cae7fb86205ee6 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 16 Apr 2022 13:40:34 -0400 Subject: [PATCH 356/371] update Clink to 1.3.15 --- CHANGELOG.md | 2 +- vendor/sources.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aeb8d0..3bd1852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ ### Changes - Update Git for Windows to 2.34.0 -- Update to Clink 1.3.14 +- Update to Clink 1.3.15 - Update to stable Conemu 210912 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` diff --git a/vendor/sources.json b/vendor/sources.json index 501d4f7..201a850 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,7 +6,7 @@ }, { "name": "clink", - "version": "1.3.14", + "version": "1.3.15", "url": "https://github.com/chrisant996/clink/releases/download/v1.3.15/clink.1.3.15.6e6e45.zip" }, { From 8bf40227e8b66f9708b7422c43b02fa62230e3dd Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Mon, 25 Apr 2022 16:47:34 -0500 Subject: [PATCH 357/371] Update Clink to 1.3.16 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 201a850..ea515aa 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -6,8 +6,8 @@ }, { "name": "clink", - "version": "1.3.15", - "url": "https://github.com/chrisant996/clink/releases/download/v1.3.15/clink.1.3.15.6e6e45.zip" + "version": "1.3.16", + "url": "https://github.com/chrisant996/clink/releases/download/v1.3.16/clink.1.3.16.023688.zip" }, { "name": "conemu-maximus5", From 62bfbb450173f3b69046570301a35a818f9eef43 Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Mon, 25 Apr 2022 16:49:28 -0500 Subject: [PATCH 358/371] Update Git for Windows to 2.36.0 --- vendor/sources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index ea515aa..54a7ee9 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.34.0.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.34.0.windows.1/PortableGit-2.34.0-64-bit.7z.exe" + "version": "v2.36.0.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.36.0.windows.1/PortableGit-2.36.0-64-bit.7z.exe" }, { "name": "clink", From 6e05a9105f5d9cc1ead2a2bb278119ed64dd06a5 Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Mon, 25 Apr 2022 16:54:49 -0500 Subject: [PATCH 359/371] Fix and Update changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd1852..62d5a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## [Unreleased](https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts) (2022-03-17) +### Changes + +- Update Git for Windows to 2.36.0 +- Update to Clink 1.3.16 + ### Fixes - Fix find and use latest Git install always using vendored Git. @@ -15,7 +20,7 @@ ### Changes - Update Git for Windows to 2.34.0 -- Update to Clink 1.3.15 +- Update to Clink 1.2.46 - Update to stable Conemu 210912 - Do not rely on having a `%cmder_root%\config\cmder_prompt_config.lua` From f2d8e31e2e176097d3babcaca60e43c7f87e6752 Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Mon, 25 Apr 2022 16:58:37 -0500 Subject: [PATCH 360/371] Update clink URL Updates the Clink URL in the readme to point to the newer maintained version of Clink that is used by Cmder. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af3c913..87b3307 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Join the chat at https://gitter.im/cmderdev/cmder](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cmderdev/cmder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://ci.appveyor.com/api/projects/status/github/cmderdev/cmder?branch=master&svg=true)](https://ci.appveyor.com/project/MartiUK/cmder) -Cmder is a **software package** created out of pure frustration over absence of usable console emulator on Windows. It is based on [ConEmu](https://conemu.github.io/) with *major* config overhaul, comes with a Monokai color scheme, amazing [clink](https://github.com/mridgers/clink) (further enhanced by [clink-completions](https://github.com/vladimir-kotikov/clink-completions)) and a custom prompt layout. +Cmder is a **software package** created out of pure frustration over absence of usable console emulator on Windows. It is based on [ConEmu](https://conemu.github.io/) with *major* config overhaul, comes with a Monokai color scheme, amazing [clink](https://chrisant996.github.io/clink/) (further enhanced by [clink-completions](https://github.com/vladimir-kotikov/clink-completions)) and a custom prompt layout. ![Cmder Screenshot](http://i.imgur.com/g1nNf0I.png) From f18471445793cb9aea94fe81f0c8beeaa5bc48d2 Mon Sep 17 00:00:00 2001 From: Michael Roy Date: Wed, 25 May 2022 15:28:29 +0200 Subject: [PATCH 361/371] Add new cmder config value Add new setting value prompt_overrideSvnStatusOptIn to cmder_prompt_config.lua.default to control of asynchronous svn status update should be used with clink --- vendor/cmder_prompt_config.lua.default | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vendor/cmder_prompt_config.lua.default b/vendor/cmder_prompt_config.lua.default index 6847f25..b9fe15e 100644 --- a/vendor/cmder_prompt_config.lua.default +++ b/vendor/cmder_prompt_config.lua.default @@ -29,14 +29,19 @@ prompt_useUserAtHost = false -- default is false prompt_singleLine = false +-- OPTIONAL. If true then Cmder includes git, mercurial, and subversion status in the prompt. + -- default is true +prompt_includeVersionControl = true + -- OPTIONAL. If true then always ignore the cmder.status and cmder.cmdstatus git config settings and run the git prompt commands in the background. -- default is false -- NOTE: This only takes effect if using Clink v1.2.10 or higher. prompt_overrideGitStatusOptIn = false --- OPTIONAL. If true then Cmder includes git, mercurial, and subversion status in the prompt. - -- default is true -prompt_includeVersionControl = true +-- OPTIONAL. If true then always ignore the cmder.status and cmder.cmdstatus svn config settings and run the svn prompt commands in the background. + -- default is false + -- NOTE: This only takes effect if using Clink v1.2.10 or higher. +prompt_overrideSvnStatusOptIn = false -- Prompt Attributes -- From 70b5822fd5ff523f680e28588ebf62a766a7b2de Mon Sep 17 00:00:00 2001 From: Michael Roy Date: Wed, 25 May 2022 15:34:22 +0200 Subject: [PATCH 362/371] Enable asynchronous clink prompt update for svn status If enabled in the cmder prompt config, use clink asynchronous update of the prompt for svn status (similar to git) --- vendor/clink.lua | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index d022238..f63f3e9 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -338,7 +338,7 @@ end -- @return {false|svn branch name} --- local function get_svn_branch(svn_dir) - local file = io.popen("svn info 2>nul") + local file = io_popenyield("svn info 2>nul") for line in file:lines() do local m = line:match("^Relative URL:") if m then @@ -396,7 +396,7 @@ end -- @return {bool} --- local function get_svn_status() - local file = io.popen("svn status -q") + local file = io_popenyield("svn status -q") for line in file:lines() do file:close() return false @@ -573,12 +573,37 @@ local function svn_prompt_filter() nostatus = get_unknown_color() } - if get_svn_dir() then + local svn_dir = get_svn_dir() + if svn_dir then -- if we're inside of svn repo then try to detect current branch local branch = get_svn_branch() local color if branch then - if get_svn_status() then + -- If in a different repo or branch than last time, discard cached info + if cached_info.svn_dir ~= svn_dir or cached_info.svn_branch ~= branch then + cached_info.svn_info = nil + cached_info.svn_dir = svn_dir + cached_info.svn_branch = branch + end + -- Get the svn status using coroutine if available and option is enabled. Otherwise use a blocking call + local svnStatus + if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") and prompt_overrideSvnStatusOptIn then + svnStatus = clink_promptcoroutine(function () + return get_svn_status() + end) + -- If the status result is pending, use the cached version instead, otherwise store it to the cache + if svnStatus == nil then + svnStatus = cached_info.svn_info + else + cached_info.svn_info = svnStatus + end + else + svnStatus = get_svn_status() + end + + if svnStatus == nil then + color = colors.nostatus + elseif svnStatus then color = colors.clean else color = colors.dirty @@ -589,7 +614,7 @@ local function svn_prompt_filter() end end - -- No mercurial present or not in mercurial file + -- No svn present or not in svn file clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", "") return false end From 0a4d3bcb7770e8111527f307b58445757202554e Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 15 Jul 2022 10:04:30 -0400 Subject: [PATCH 363/371] update Clink and Git --- vendor/sources.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 54a7ee9..620677b 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,13 +1,13 @@ [ { "name": "git-for-windows", - "version": "v2.36.0.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.36.0.windows.1/PortableGit-2.36.0-64-bit.7z.exe" + "version": "v2.37.1.windows.1", + "url": "https://github.com/git-for-windows/git/releases/download/v2.37.1.windows.1/PortableGit-2.37.1-64-bit.7z.exe" }, { "name": "clink", - "version": "1.3.16", - "url": "https://github.com/chrisant996/clink/releases/download/v1.3.16/clink.1.3.16.023688.zip" + "version": "1.3.36", + "url": "https://github.com/chrisant996/clink/releases/download/v1.3.36/clink.1.3.36.32d0bc.zip" }, { "name": "conemu-maximus5", From 5f25ea58a0617345c632d0fb5989d4c103f41cfe Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 15 Jul 2022 10:08:52 -0400 Subject: [PATCH 364/371] update Clink and Git --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d5a6d..d03b591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ ### Changes -- Update Git for Windows to 2.36.0 -- Update to Clink 1.3.16 +- Update Git for Windows to 2.37.1 +- Update to Clink 1.3.36 ### Fixes From a617397aea181da2a54ff39164b067040075c692 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Tue, 30 Aug 2022 21:59:09 +0430 Subject: [PATCH 365/371] move space from "{git}{hg}{svn}" to individual parts --- vendor/clink.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index f63f3e9..e56e087 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -166,7 +166,7 @@ local function set_prompt_filter() if uah ~= '' then uah = get_uah_color() .. uah end if cwd ~= '' then cwd = get_cwd_color() .. cwd end - local version_control = prompt_includeVersionControl and " {git}{hg}{svn}" or "" + local version_control = prompt_includeVersionControl and "{git}{hg}{svn}" or "" prompt = "{uah}{cwd}" .. version_control .. get_lamb_color() .. cr .. "{env}{lamb} \x1b[0m" prompt = string.gsub(prompt, "{uah}", uah) @@ -507,7 +507,7 @@ local function git_prompt_filter() else color = colors.nostatus end - clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") + clink.prompt.value = string.gsub(clink.prompt.value, "{git}", " "..color.."("..verbatim(branch)..")") return false end end @@ -555,7 +555,7 @@ local function hg_prompt_filter() end end - clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", verbatim(result)) + clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", " "..verbatim(result)) return false end @@ -609,7 +609,7 @@ local function svn_prompt_filter() color = colors.dirty end - clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..verbatim(branch)..")") + clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", " "..color.."("..verbatim(branch)..")") return false end end From ec371bafffdc8d7182ed44b9e3ed83c35d010ce4 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Tue, 30 Aug 2022 22:10:12 +0430 Subject: [PATCH 366/371] Update Clink, Clink Completions and ConEmu dependencies --- vendor/sources.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vendor/sources.json b/vendor/sources.json index 620677b..18a1619 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,22 +1,22 @@ [ { "name": "git-for-windows", - "version": "v2.37.1.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.37.1.windows.1/PortableGit-2.37.1-64-bit.7z.exe" + "version": "2.37.2.windows.2", + "url": "https://github.com/git-for-windows/git/releases/download/v2.37.2.windows.2/PortableGit-2.37.2.2-64-bit.7z.exe" }, { "name": "clink", - "version": "1.3.36", - "url": "https://github.com/chrisant996/clink/releases/download/v1.3.36/clink.1.3.36.32d0bc.zip" + "version": "1.3.40", + "url": "https://github.com/chrisant996/clink/releases/download/v1.3.40/clink.1.3.40.1901c2.zip" }, { "name": "conemu-maximus5", - "version": "210912", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v21.09.12/ConEmuPack.210912.7z" + "version": "220807", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v22.08.07/ConEmuPack.220807.7z" }, { "name": "clink-completions", - "version": "0.3.7", - "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.7.zip" + "version": "0.4.1", + "url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.4.1.zip" } ] From 7a9ad78e66b2188a17fa42ea0a4c370478c78131 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Thu, 1 Sep 2022 13:00:43 +0000 Subject: [PATCH 367/371] Fix #2740 --- Cmder.bat | 6 +++++- vendor/lib/lib_path.cmd | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cmder.bat b/Cmder.bat index 6a95148..3062c37 100644 --- a/Cmder.bat +++ b/Cmder.bat @@ -4,8 +4,12 @@ SET CMDER_ROOT=%~dp0 :: Remove Trailing '\' @if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1% +if not exist "%CMDER_ROOT%\config\user_ConEmu.xml" ( + copy "%CMDER_ROOT%\vendor\ConEmu.xml.default" "%CMDER_ROOT%\config\user_ConEmu.xml" +) + if exist "%~1" ( start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%~1" ) else ( - start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\ConEmu.xml" + start %~dp0/vendor/conemu-maximus5/ConEmu.exe /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\user_ConEmu.xml" ) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 933d2f3..281839a 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -121,11 +121,11 @@ exit /b exit /b :toolong - echo "%OLD_PATH%">tempfileA - echo "%PATH%">tempfileB - fc /b tempfileA tempfileB 2>nul 1>nul - if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed ) - del tempfileA & del tempfileB + echo "%OLD_PATH%">"%temp%\tempfileA" + echo "%PATH%">"%temp%\tempfileB" + fc /b "%temp%\tempfileA" "%temp%\tempfileB" 2>nul 1>nul + if errorlevel 1 ( del "%temp%\tempfileA" & del "%temp%\tempfileB" & goto :changed ) + del "%temp%\tempfileA" & del "%temp%\tempfileB" exit /b :changed From 59bbdaddc75ebfb9225c7b769462ad93ea29388a Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 4 Sep 2022 09:16:39 -0400 Subject: [PATCH 368/371] Cleanup --- .gitignore | 1 + CHANGELOG.md | 2 +- vendor/lib/lib_path.cmd | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 3431088..5ce4390 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ Version v* .github_changelog_generator launcher/.vs launcher/src/version.rc2 +.vs/* diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d5a6d..8cce8c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [Unreleased](https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts) (2022-03-17) +## [1.3.20-unreleased](https://ci.appveyor.com/project/MartiUK/cmder/build/artifacts) (2022-03-17) ### Changes diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 281839a..6e05aad 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -121,11 +121,11 @@ exit /b exit /b :toolong - echo "%OLD_PATH%">"%temp%\tempfileA" - echo "%PATH%">"%temp%\tempfileB" - fc /b "%temp%\tempfileA" "%temp%\tempfileB" 2>nul 1>nul - if errorlevel 1 ( del "%temp%\tempfileA" & del "%temp%\tempfileB" & goto :changed ) - del "%temp%\tempfileA" & del "%temp%\tempfileB" + echo "%OLD_PATH%">"%temp%\cmder_lib_pathA" + echo "%PATH%">"%temp%\cmder_lib_pathB" + fc /b "%temp%\cmder_lib_pathA" "%temp%\cmder_lib_pathB" 2>nul 1>nul + if errorlevel 1 ( del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" & goto :changed ) + del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" exit /b :changed From 61e70285664d594a2a2b63db77c22e2d63765976 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 4 Sep 2022 09:23:03 -0400 Subject: [PATCH 369/371] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cce8c1..6dab66e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixes +- Fix #2740 - Fix find and use latest Git install always using vendored Git. - Fix using Git from vendored Git and other Git for Windows tools from other Git in path. - Remove setting `term=cygwin` in `init.bat` to fix random `ABCD` characters when using arrow keys in `vim`. From d1b1012741d571379536d7ad0a37d62dad2effb7 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Fri, 9 Sep 2022 17:24:25 +0430 Subject: [PATCH 370/371] minimal comspec detection (fixes #2744) --- vendor/lib/lib_base.cmd | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 6f2ed30..8c0fda8 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -61,22 +61,21 @@ exit /b ::: file full path to file containing lib_routines to display :::. :::------------------------------------------------------------------------------- - echo %comspec% | %WINDIR%\System32\find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd" - echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc" - echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle" - + call :detect_comspec %ComSpec% + exit /b + +:detect_comspec + CMDER_SHELL=%~n1 if not defined CMDER_CLINK ( set CMDER_CLINK=1 if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0 if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0 ) - if not defined CMDER_ALIASES ( set CMDER_ALIASES=1 if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0 if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0 ) - exit /b :update_legacy_aliases From e2d817a49727c9aab04b6ce331c11b372dc83827 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 9 Sep 2022 09:11:45 -0400 Subject: [PATCH 371/371] Add set to fix error --- vendor/lib/lib_base.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 8c0fda8..1ca8a9f 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -65,7 +65,7 @@ exit /b exit /b :detect_comspec - CMDER_SHELL=%~n1 + set CMDER_SHELL=%~n1 if not defined CMDER_CLINK ( set CMDER_CLINK=1 if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0