From 864f7780998512f066d3146cba99705cca457fda Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 24 Mar 2018 08:03:28 -0500 Subject: [PATCH 01/36] 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 02/36] 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 0f99f66b42158f3ecf528e16bc3a8692b6e38e22 Mon Sep 17 00:00:00 2001 From: Bob Hood Date: Fri, 6 Jul 2018 14:34:48 -0600 Subject: [PATCH 03/36] 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 b901a4a569bbba59c977f20da9c48c543e4e40e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Thu, 23 Aug 2018 11:50:29 +0800 Subject: [PATCH 04/36] add LANG support --- vendor/init.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vendor/init.bat b/vendor/init.bat index 1328fc7..4a31844 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -203,9 +203,12 @@ 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 ( + set "LANG=%%F" + ) ) -endlocal & set "PATH=%PATH%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%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%'" goto :PATH_ENHANCE From 34bb62409a5b2f31c5092cdca602d892a1b40dc4 Mon Sep 17 00:00:00 2001 From: "Dmitri S. Guskov" Date: Wed, 29 Aug 2018 14:38:59 +0300 Subject: [PATCH 05/36] Update profile.ps1 Fixes Powershell 5.1 error when Windows Software Restriction Policy is enabled: bin\vendor\profile.ps1 : Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator. At line:1 char:1 + . 'bin\vendor\conemu-maximus5\..\profi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [profile.ps1], NotSupportedException + FullyQualifiedErrorId : DotSourceNotSupported,profile.ps1 --- vendor/profile.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index b59e773..2952618 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -134,7 +134,7 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { pushd $ENV:CMDER_ROOT\config\profile.d foreach ($x in Get-ChildItem *.ps1) { # write-host write-host Sourcing $x - . $x + Import-Module $x } popd @@ -144,7 +144,7 @@ if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profil pushd $ENV:CMDER_USER_CONFIG\profile.d foreach ($x in Get-ChildItem *.ps1) { # write-host write-host Sourcing $x - . $x + Import-Module $x } popd } @@ -154,13 +154,13 @@ if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profil $CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1" if (Test-Path $CmderUserProfilePath) { # Create this file and place your own command in there. - . "$CmderUserProfilePath" + Import-Module "$CmderUserProfilePath" } if ($ENV:CMDER_USER_CONFIG) { $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user-profile.ps1" if (Test-Path $CmderUserProfilePath) { - . "$CmderUserProfilePath" + Import-Module "$CmderUserProfilePath" } } From 21b1f009813fc7c4eef8c12a204424389ba413fb Mon Sep 17 00:00:00 2001 From: "Dmitri S. Guskov" Date: Wed, 29 Aug 2018 14:42:01 +0300 Subject: [PATCH 06/36] Powershell 5.1 compatibility Fixes Powershell 5.1 error when Windows Software Restriction Policy is enabled: bin\vendor\profile.ps1 : Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator. At line:1 char:1 + . 'bin\vendor\conemu-maximus5\..\profi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [profile.ps1], NotSupportedException + FullyQualifiedErrorId : DotSourceNotSupported,profile.ps1 --- config/ConEmu.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/ConEmu.xml b/config/ConEmu.xml index db45a6a..c4f4fff 100644 --- a/config/ConEmu.xml +++ b/config/ConEmu.xml @@ -508,7 +508,7 @@ - + @@ -517,7 +517,7 @@ - + From e80ad2356f58716b430331e37b3fbb11043a5090 Mon Sep 17 00:00:00 2001 From: Arion Roberto Krause Date: Wed, 29 Aug 2018 22:07:26 -0300 Subject: [PATCH 07/36] Fixed typo --- 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 f417764..bcb7bca 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -386,7 +386,7 @@ cmderOptions GetOption() i++; } else { - MessageBox(NULL, szArgList[i + 1], L"/START - Folder doses not exist!", MB_OK); + MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } else if (_wcsicmp(L"/task", szArgList[i]) == 0) From 08e1244fe523a74db59cc78674bbeaf4487defba Mon Sep 17 00:00:00 2001 From: David Refoua Date: Tue, 28 Aug 2018 18:03:38 +0430 Subject: [PATCH 08/36] fix some spelling issues --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bbb74f7..ed6c1be 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Aliases defined using the `alias.bat` command will automatically be saved in the 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`. Anyhing stored in `%CMDER_ROOT%` will be a portable setting and will follow cmder to another machine. +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` @@ -202,7 +202,7 @@ 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`. Anyhing 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' From d91438de47b47f7ceb4c3c09923cea9f20052673 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Thu, 30 Aug 2018 15:21:51 +0200 Subject: [PATCH 09/36] replace user-aliases with user_aliases --- vendor/init.bat | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 1328fc7..09c797e 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -245,24 +245,24 @@ 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%" + 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%" +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%" ) ) ) @@ -270,15 +270,15 @@ if not exist "%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" + 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 e4fb0d694b8007c48603e42add8e5b861064ce81 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Fri, 31 Aug 2018 18:40:53 +0200 Subject: [PATCH 10/36] Revert "replace user-aliases with user_aliases" This reverts commit d91438de47b47f7ceb4c3c09923cea9f20052673. --- vendor/init.bat | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 09c797e..1328fc7 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -245,24 +245,24 @@ 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%" + 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%" +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%" ) ) ) @@ -270,15 +270,15 @@ if not exist "%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" + 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 49da3745bce7c4f850079c0cc5a92ee978207b56 Mon Sep 17 00:00:00 2001 From: Dax T Games Date: Fri, 31 Aug 2018 17:02:56 -0500 Subject: [PATCH 11/36] Fix #1806 #1675 (#1870) ## Rename user-profile.* user_profile.* to resolve #1806, #1675 * This is a backward compatible fix and will automatically and silently rename users '%cmder_root%/config/user-profile.\*' to '%cmder_root%/config/user_profile.\*' and '[user_specified_config_root]/user-profile.\*' to '[user_specified_config_root]/user_profile.\*' if the sources exist. * Cmder.exe does this for cmd.exe sessions. * The init scripts for bash and Powershell handles it for these shells --- .gitignore | 2 ++ README.md | 22 ++++++------- launcher/src/CmderLauncher.cpp | 33 ++++++++++++++++++- vendor/cmder.sh | 31 ++++++++++++------ vendor/cmder_exinit | 58 ++++++++++++++++++++-------------- vendor/init.bat | 14 ++++---- vendor/profile.ps1 | 18 ++++++++--- 7 files changed, 120 insertions(+), 58 deletions(-) diff --git a/.gitignore b/.gitignore index cf231c5..2ae90c5 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,10 @@ build/ Version v* *.bak config/user-* +config/user_* config/settings config/aliases config/profile.d .github_changelog_generator launcher/.vs +launcher/src/version.rc2 diff --git a/README.md b/README.md index ed6c1be..b7e2f21 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ From a bash/mintty shell: cd $CMDER_ROOT/vendor git clone https://github.com/karlin/mintty-colors-solarized.git cd mintty-colors-solarized/ -echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh>>$CMDER_ROOT/config/user-profile.sh +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). @@ -154,11 +154,11 @@ 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` | -| Bash/Mintty | `$CMDER_ROOT/config/user-profile.sh` | +| 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`. +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. @@ -182,7 +182,7 @@ Note: These are loaded in this order by `$CMDER_ROOT/vendor/init.bat`. Anything * `%CMDER_ROOT%\\config\\profile.d\\\*.cmd` and `\*.bat` * `%CMDER_ROOT%\\config\\user-aliases.cmd` -* `%CMDER_ROOT%\\config\\user-profile.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. @@ -192,26 +192,26 @@ 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/git-for-windows/etc/profile.d/cmder.sh`. Anything stored in `$CMDER_ROOT` will be a portable setting and will follow cmder to another machine. * `$CMDER_ROOT/config/profile.d/*.sh` -* `$CMDER_ROOT/config/user-profile.sh` +* `$CMDER_ROOT/config/user_profile.sh` * `$HOME/.bashrc` -If you add bash aliases to `$CMDER_ROOT/config/user-profile.sh` they will be portable and follow your Cmder folder if you copy it to another machine. `$HOME/.bashrc` defined aliases are not portable. +If you add bash aliases to `$CMDER_ROOT/config/user_profile.sh` they will be portable and follow your Cmder folder if you copy it to another machine. `$HOME/.bashrc` defined aliases are not portable. #### PowerShell.exe Aliases PowerShell has native simple alias support, for example `[new-alias | set-alias] alias command`, so complex aliases with optional parameters are not supported in PowerShell sessions. Type `get-help [new-alias|set-alias] -full` for help on PowerShell aliases. 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\\user_profile.ps1' ### SSH Agent To start the vendored SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-for-windows/cmd` folder. -If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"` in `%CMDER_ROOT%/config/user-profile.cmd` (usually just uncomment it). +If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"` in `%CMDER_ROOT%/config/user_profile.cmd` (usually just uncomment it). ### Vendored Git diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index bcb7bca..9f0a275 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -9,6 +9,7 @@ #include #pragma comment(lib, "Shlwapi.lib") +#pragma warning( disable : 4091 ) #ifndef UNICODE #error "Must be compiled with unicode support." @@ -85,6 +86,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t userConfigDirPath[MAX_PATH] = { 0 }; wchar_t userBinDirPath[MAX_PATH] = { 0 }; wchar_t userProfiledDirPath[MAX_PATH] = { 0 }; + wchar_t userProfilePath[MAX_PATH] = { 0 }; + wchar_t legacyUserProfilePath[MAX_PATH] = { 0 }; wchar_t args[MAX_PATH * 2 + 256] = { 0 }; std::wstring cmderStart = path; @@ -104,6 +107,21 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(icoPath, exeDir, L"icons\\cmder.ico"); PathCombine(configDirPath, exeDir, L"config"); + + PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); + if (PathFileExists(legacyUserProfilePath)) { + PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); + + char *lPr = (char *)malloc(MAX_PATH); + char *pR = (char *)malloc(MAX_PATH); + size_t i; + wcstombs_s(&i, lPr, (size_t)MAX_PATH, + legacyUserProfilePath, (size_t)MAX_PATH); + wcstombs_s(&i, pR, (size_t)MAX_PATH, + userProfilePath, (size_t)MAX_PATH); + rename(lPr, pR); + } + if (wcscmp(userConfigDirPath, L"") == 0) { PathCombine(userConfigDirPath, exeDir, L"config"); @@ -118,6 +136,20 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); + + PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); + if (PathFileExists(legacyUserProfilePath)) { + PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); + + char *lPr = (char *)malloc(MAX_PATH); + char *pR = (char *)malloc(MAX_PATH); + size_t i; + wcstombs_s(&i, lPr, (size_t)MAX_PATH, + legacyUserProfilePath, (size_t)MAX_PATH); + wcstombs_s(&i, pR, (size_t)MAX_PATH, + userProfilePath, (size_t)MAX_PATH); + rename(lPr, pR); + } } // Set path to vendored ConEmu config file @@ -131,7 +163,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) { if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index 90bca50..aa59642 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -1,6 +1,6 @@ # DO NOT EDIT THIS FILE IT WILL BE OVERWRITTEN ON UPDATE # -# Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh, +# Add portable user customizations ${CMDER_ROOT}/config/user_profile.sh, # these customizations will follow Cmder if $CMDER_ROOT is copied # to another machine. # @@ -63,21 +63,32 @@ if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then runProfiled "${CMDER_USER_CONFIG}/profile.d" fi -initialConfig="${CMDER_ROOT}/config/user-profile.sh" -if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then - . "${CMDER_ROOT}/config/user-profile.sh" + +# Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. +if [ -f "$CMDER_ROOT/config/user-profile.sh" ] ; then + mv "$CMDER_ROOT/config/user-profile.sh" "$CMDER_ROOT/config/user_profile.sh" +fi + +CmderUserProfilePath="${CMDER_ROOT}/config/user_profile.sh" +if [ -f "${CMDER_ROOT}/config/user_profile.sh" ] ; then + . "${CMDER_ROOT}/config/user_profile.sh" fi if [ "${CMDER_USER_CONFIG}" != "" ] ; then - initialConfig="${CMDER_USER_CONFIG}/user-profile.sh" - if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then - . "${CMDER_USER_CONFIG}/user-profile.sh" + # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. + if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then + mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" + fi + + CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" + if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then + . "${CMDER_USER_CONFIG}/user_profile.sh" fi fi -if [ ! -f "${initialConfig}" ] ; then - echo Creating user startup file: "${initialConfig}" - cat <<-eof >"${initialConfig}" +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: diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index f20bef1..c182aee 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -1,4 +1,4 @@ -# Copy this file to your non integrated *nix-like environment, +# Copy this file to your non integrated *nix-like environment, # Cygwin/MSys2/Git for Windows SDK, installs '/etc/profile.d/' # folder to integrate the externally installed Unix like environment # into Cmder so it has access to settings stored in Cmder/config @@ -15,7 +15,7 @@ # These customizations will follow Cmder if $CMDER_ROOT is copied # to another machine. # -# Add system specific users customizations to $HOME/.bashrc, these +# Add system specific users customizations to $HOME/.bashrc, these # customizations will not follow Cmder to another machine. # # Uncomment and edit the CMDER_ROOT line to use Cmder/config even when launched @@ -58,45 +58,55 @@ fi if [ ! "$CMDER_ROOT" = "" ] ; then # Remove any trailing '/' CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') - + echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"." - + export CMDER_ROOT - + PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} - + export PATH - + # Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" # to source them at startup. if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then mkdir -p "${CMDER_ROOT}/config/profile.d" fi - + if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then runProfiled "${CMDER_ROOT}/config/profile.d" fi - + if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then runProfiled "${CMDER_USER_CONFIG}/profile.d" fi - - if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then - . "${CMDER_ROOT}/config/user-profile.sh" + + # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. + if [ -f "$CMDER_ROOT/config/user-profile.sh" ] ; then + mv "$CMDER_ROOT/config/user-profile.sh" "$CMDER_ROOT/config/user_profile.sh" fi - - if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then - . "${CMDER_USER_CONFIG}/user-profile.sh" - else - if [ "${CMDER_USER_CONFIG}" != "" ] ; then - initialProfile="${CMDER_USER_CONFIG}/user-profile.sh" - else - initialProfile="${CMDER_ROOT}/config/user-profile.sh" - fi - - echo Creating user startup file: "${initialProfile}" - cat <<-eof >"${initialProfile}" + + CmderUserProfilePath="${CMDER_ROOT}/config/user_profile.sh" + if [ -f "${CMDER_ROOT}/config/user_profile.sh" ] ; then + . "${CMDER_ROOT}/config/user_profile.sh" + fi + + if [ "${CMDER_USER_CONFIG}" != "" ] ; then + # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. + if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then + mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" + fi + + CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" + if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then + . "${CMDER_USER_CONFIG}/user_profile.sh" + fi + 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: diff --git a/vendor/init.bat b/vendor/init.bat index 1328fc7..9959275 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -4,7 +4,7 @@ :: 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 "%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 @@ -294,17 +294,17 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( 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" ( +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" ( + 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" ) ) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index 2952618..8c9f207 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -2,7 +2,7 @@ # Created as part of cmder project # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED -# !!! Use "%CMDER_ROOT%\config\user-profile.ps1" to add your own startup commands +# !!! Use "%CMDER_ROOT%\config\user_profile.ps1" to add your own startup commands # Compatibility with PS major versions <= 2 if(!$PSScriptRoot) { @@ -97,7 +97,7 @@ $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT" # # Prompt Section -# Users should modify their user-profile.ps1 as it will be safe from updates. +# 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. @@ -149,16 +149,24 @@ 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 +} - -$CmderUserProfilePath = Join-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" } if ($ENV:CMDER_USER_CONFIG) { - $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user-profile.ps1" + # Renaming to "$env:CMDER_USER_CONFIG\user-profile.ps1" to "user_profile.ps1" for consistency. + if (test-path "$env:CMDER_USER_CONFIG\user-profile.ps1") { + rename-item "$env:CMDER_USER_CONFIG\user-profile.ps1" user_profile.ps1 + } + + $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1" if (Test-Path $CmderUserProfilePath) { Import-Module "$CmderUserProfilePath" } From e69e7f9b82a5bd002412a5f684d5a52c1997457b Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 1 Sep 2018 14:59:40 -0400 Subject: [PATCH 12/36] 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 13/36] 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 14/36] 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 15/36] 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 16/36] 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 17/36] 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 18/36] 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 19/36] 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 20/36] 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 21/36] 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 22/36] 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 23/36] 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 24/36] 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 25/36] 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 26/36] 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 27/36] '.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 28/36] 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 29/36] '.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 30/36] 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 31/36] 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 32/36] 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 33/36] 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 34/36] 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 35/36] :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 36/36] :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",