Merge branch 'master' into master

This commit is contained in:
Retomehere 2018-09-15 11:28:04 +08:00 committed by GitHub
commit 0730c6e32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 404 additions and 196 deletions

6
.gitignore vendored
View File

@ -1,7 +1,10 @@
## Those files should be taken from their repositary ## Those files should be taken from their repositary
bin/*/*
!bin/Readme.md
vendor/*/* vendor/*/*
!vendor/bin/*
!vendor/lib/* !vendor/lib/*
!vendor/* !vendor/*
!vendor/psmodules/PsGet !vendor/psmodules/PsGet
@ -14,8 +17,11 @@ build/
Version v* Version v*
*.bak *.bak
config/user-* config/user-*
config/user_*
config/*.lua
config/settings config/settings
config/aliases config/aliases
config/profile.d config/profile.d
.github_changelog_generator .github_changelog_generator
launcher/.vs launcher/.vs
launcher/src/version.rc2

View File

@ -117,7 +117,7 @@ From a bash/mintty shell:
cd $CMDER_ROOT/vendor cd $CMDER_ROOT/vendor
git clone https://github.com/karlin/mintty-colors-solarized.git git clone https://github.com/karlin/mintty-colors-solarized.git
cd mintty-colors-solarized/ 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). 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).
@ -155,11 +155,11 @@ Single user portable configuration is possible using the cmder specific shell co
| Shell | Cmder Portable User Config | | Shell | Cmder Portable User Config |
| ------------- | ----------------------------------------- | | ------------- | ----------------------------------------- |
| Cmder | `%CMDER_ROOT%\\config\\user-profile.cmd` | | Cmder | `%CMDER_ROOT%\\config\\user_profile.cmd` |
| PowerShell | `$ENV:CMDER_ROOT\\config\\user-profile.ps1` | | PowerShell | `$ENV:CMDER_ROOT\\config\\user_profile.ps1` |
| Bash/Mintty | `$CMDER_ROOT/config/user-profile.sh` | | Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` |
Note: Bash and Mintty sessions will also source the `$HOME/.bashrc` file if it exists after it sources `$CMDER_ROOT/config/user-profile.sh`. 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. 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.
@ -179,11 +179,11 @@ 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: 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\\profile.d\\\*.cmd` and `\*.bat`
* `%CMDER_ROOT%\\config\\user-aliases.cmd` * `%CMDER_ROOT%\\config\\user-aliases.cmd`
* `%CMDER_ROOT%\\config\\user-profile.cmd` * `%CMDER_ROOT%\\config\\user_profile.cmd`
#### Bash.exe|Mintty.exe Aliases #### 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. 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.
@ -193,26 +193,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. 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/profile.d/*.sh`
* `$CMDER_ROOT/config/user-profile.sh` * `$CMDER_ROOT/config/user_profile.sh`
* `$HOME/.bashrc` * `$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.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. 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: 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\\profile.d\\\*.ps1'
* '$ENV:CMDER_ROOT\\config\\user-profile.ps1' * '$ENV:CMDER_ROOT\\config\\user_profile.ps1'
### SSH Agent ### SSH Agent
To start the vendored SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-for-windows/cmd` folder. 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 ### Vendored Git

View File

@ -508,7 +508,7 @@
<value name="Name" type="string" data="{PowerShell::PowerShell as Admin}"/> <value name="Name" type="string" data="{PowerShell::PowerShell as Admin}"/>
<value name="Hotkey" type="dword" data="00000000"/> <value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/> <value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/>
<value name="Cmd1" type="string" data="*PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot;"/> <value name="Cmd1" type="string" data="*PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression 'Import-Module ''%ConEmuDir%\..\profile.ps1'''&quot;"/>
<value name="Active" type="long" data="0"/> <value name="Active" type="long" data="0"/>
<value name="Count" type="long" data="1"/> <value name="Count" type="long" data="1"/>
<value name="Flags" type="dword" data="00000000"/> <value name="Flags" type="dword" data="00000000"/>
@ -517,7 +517,7 @@
<value name="Name" type="string" data="{PowerShell::PowerShell}"/> <value name="Name" type="string" data="{PowerShell::PowerShell}"/>
<value name="Hotkey" type="dword" data="00000000"/> <value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/> <value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/>
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot;"/> <value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression 'Import-Module ''%ConEmuDir%\..\profile.ps1'''&quot;"/>
<value name="Cmd2" type="string" data="&quot;%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe&quot;"/> <value name="Cmd2" type="string" data="&quot;%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe&quot;"/>
<value name="Active" type="long" data="0"/> <value name="Active" type="long" data="0"/>
<value name="Count" type="long" data="1"/> <value name="Count" type="long" data="1"/>

View File

@ -9,6 +9,7 @@
#include <iostream> #include <iostream>
#pragma comment(lib, "Shlwapi.lib") #pragma comment(lib, "Shlwapi.lib")
#pragma warning( disable : 4091 )
#ifndef UNICODE #ifndef UNICODE
#error "Must be compiled with unicode support." #error "Must be compiled with unicode support."
@ -85,6 +86,10 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
wchar_t userConfigDirPath[MAX_PATH] = { 0 }; wchar_t userConfigDirPath[MAX_PATH] = { 0 };
wchar_t userBinDirPath[MAX_PATH] = { 0 }; wchar_t userBinDirPath[MAX_PATH] = { 0 };
wchar_t userProfiledDirPath[MAX_PATH] = { 0 }; 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 }; wchar_t args[MAX_PATH * 2 + 256] = { 0 };
std::wstring cmderStart = path; std::wstring cmderStart = path;
@ -104,6 +109,35 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
PathCombine(icoPath, exeDir, L"icons\\cmder.ico"); PathCombine(icoPath, exeDir, L"icons\\cmder.ico");
PathCombine(configDirPath, exeDir, L"config"); 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);
}
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) if (wcscmp(userConfigDirPath, L"") == 0)
{ {
PathCombine(userConfigDirPath, exeDir, L"config"); PathCombine(userConfigDirPath, exeDir, L"config");
@ -118,6 +152,34 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d");
SHCreateDirectoryEx(0, userProfiledDirPath, 0); 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);
}
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 // Set path to vendored ConEmu config file
@ -131,7 +193,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
if (PathFileExists(cpuCfgPath)) { if (PathFileExists(cpuCfgPath)) {
if (PathFileExists(cfgPath)) { if (PathFileExists(cfgPath)) {
if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
@ -361,6 +422,7 @@ cmderOptions GetOption()
for (int i = 1; i < argCount; i++) for (int i = 1; i < argCount; i++)
{ {
// MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK); // MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK);
if (_wcsicmp(L"/c", szArgList[i]) == 0) if (_wcsicmp(L"/c", szArgList[i]) == 0)
@ -380,13 +442,19 @@ cmderOptions GetOption()
} }
else if (_wcsicmp(L"/start", szArgList[i]) == 0) 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])) if (PathFileExists(szArgList[i + 1]))
{ {
cmderOptions.cmderStart = szArgList[i + 1]; cmderOptions.cmderStart = szArgList[i + 1];
i++; i++;
} }
else { 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) else if (_wcsicmp(L"/task", szArgList[i]) == 0)
@ -424,9 +492,22 @@ cmderOptions GetOption()
} }
} }
} }
else if (cmderOptions.cmderStart == L"" && PathFileExists(szArgList[i])) else if (cmderOptions.cmderStart == L"")
{
int len = wcslen(szArgList[i]);
if (wcscmp(&szArgList[i][len - 1], L"\"") == 0)
{
szArgList[i][len - 1] = '\0';
}
if (PathFileExists(szArgList[i]))
{ {
cmderOptions.cmderStart = szArgList[i]; cmderOptions.cmderStart = szArgList[i];
i++;
}
else {
MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK);
}
} }
else { else {
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); 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);

View File

@ -2,7 +2,7 @@
if "%ALIASES%" == "" ( if "%ALIASES%" == "" (
set ALIASES="%CMDER_ROOT%\config\user-aliases.cmd" set ALIASES="%CMDER_ROOT%\config\user_aliases.cmd"
) )
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
@ -50,7 +50,7 @@ goto parseargument
) )
rem #endregion parseargument rem #endregion parseargument
if "%ALIASES%" neq "%CMDER_ROOT%\config\user-aliases.cmd" ( if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
set _x=!_x:/f "%ALIASES%" =! set _x=!_x:/f "%ALIASES%" =!
if not exist "%ALIASES%" ( if not exist "%ALIASES%" (
@ -117,9 +117,9 @@ echo.Options:
echo. echo.
echo. /d [alias] Delete an [alias]. echo. /d [alias] Delete an [alias].
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in. echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo. Default: %cmder_root%\config\user-aliases.cmd echo. Default: %cmder_root%\config\user_aliases.cmd
echo. /reload Reload the aliases file. Can be used with /f argument. echo. /reload Reload the aliases file. Can be used with /f argument.
echo. Default: %cmder_root%\config\user-aliases.cmd echo. Default: %cmder_root%\config\user_aliases.cmd
echo. echo.
echo. If alias is called with no parameters, it will display the list of existing aliases. echo. If alias is called with no parameters, it will display the list of existing aliases.
echo. echo.

63
vendor/clink.lua vendored
View File

@ -285,31 +285,40 @@ end
local function hg_prompt_filter() local function hg_prompt_filter()
local result = ""
local hg_dir = get_hg_dir()
if hg_dir then
-- Colors for mercurial status -- Colors for mercurial status
local colors = { local colors = {
clean = "\x1b[1;37;40m", clean = "\x1b[1;37;40m",
dirty = "\x1b[31;1m", dirty = "\x1b[31;1m",
} }
if get_hg_dir() then -- 'hg id' gives us BOTH the branch name AND an indicator that there
-- if we're inside of mercurial repo then try to detect current branch -- are uncommitted changes, in one fast(er) call
local branch = get_hg_branch() local pipe = io.popen("hg id 2>&1")
local color local output = pipe:read('*all')
if branch then local rc = { pipe:close() }
-- Has branch => therefore it is a mercurial folder, now figure out status
if get_hg_status() then
color = colors.clean
else
color = colors.dirty
end
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", color.."("..branch..")") if output ~= nil and
return false 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
-- 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
end end
-- No mercurial present or not in mercurial file clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", result)
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", "")
return false return false
end end
@ -358,3 +367,27 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do
dofile(filename) dofile(filename)
end end
end end
local cmder_config_dir = clink.get_env('CMDER_ROOT')..'/config/'
for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do
-- Skip files that starts with _. This could be useful if some files should be ignored
if not string.match(lua_module, '^_.*') then
local filename = cmder_config_dir..lua_module
-- use dofile instead of require because require caches loaded modules
-- so config reloading using Alt-Q won't reload updated modules.
dofile(filename)
end
end
if clink.get_env('CMDER_USER_CONFIG') then
local cmder_user_config_dir = clink.get_env('CMDER_USER_CONFIG')..'/'
for _,lua_module in ipairs(clink.find_files(cmder_user_config_dir..'*.lua')) do
-- Skip files that starts with _. This could be useful if some files should be ignored
if not string.match(lua_module, '^_.*') then
local filename = cmder_user_config_dir..lua_module
-- use dofile instead of require because require caches loaded modules
-- so config reloading using Alt-Q won't reload updated modules.
dofile(filename)
end
end
end

31
vendor/cmder.sh vendored
View File

@ -1,6 +1,6 @@
# DO NOT EDIT THIS FILE IT WILL BE OVERWRITTEN ON UPDATE # 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 # these customizations will follow Cmder if $CMDER_ROOT is copied
# to another machine. # to another machine.
# #
@ -63,21 +63,32 @@ if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then
runProfiled "${CMDER_USER_CONFIG}/profile.d" runProfiled "${CMDER_USER_CONFIG}/profile.d"
fi fi
initialConfig="${CMDER_ROOT}/config/user-profile.sh"
if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency.
. "${CMDER_ROOT}/config/user-profile.sh" 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 fi
if [ "${CMDER_USER_CONFIG}" != "" ] ; then if [ "${CMDER_USER_CONFIG}" != "" ] ; then
initialConfig="${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 if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then
. "${CMDER_USER_CONFIG}/user-profile.sh" 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
fi fi
if [ ! -f "${initialConfig}" ] ; then if [ ! -f "${CmderUserProfilePath}" ] ; then
echo Creating user startup file: "${initialConfig}" echo Creating user startup file: "${CmderUserProfilePath}"
cat <<-eof >"${initialConfig}" cat <<-eof >"${CmderUserProfilePath}"
# use this file to run your own startup commands for msys2 bash' # use this file to run your own startup commands for msys2 bash'
# To add a new vendor to the path, do something like: # To add a new vendor to the path, do something like:

30
vendor/cmder_exinit vendored
View File

@ -82,21 +82,31 @@ if [ ! "$CMDER_ROOT" = "" ] ; then
fi fi
if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency.
. "${CMDER_ROOT}/config/user-profile.sh" 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 fi
if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then
. "${CMDER_USER_CONFIG}/user-profile.sh"
else
if [ "${CMDER_USER_CONFIG}" != "" ] ; then if [ "${CMDER_USER_CONFIG}" != "" ] ; then
initialProfile="${CMDER_USER_CONFIG}/user-profile.sh" # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency.
else if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then
initialProfile="${CMDER_ROOT}/config/user-profile.sh" mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh"
fi fi
echo Creating user startup file: "${initialProfile}" CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh"
cat <<-eof >"${initialProfile}" 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' # use this file to run your own startup commands for msys2 bash'
# To add a new vendor to the path, do something like: # To add a new vendor to the path, do something like:

158
vendor/init.bat vendored
View File

@ -4,12 +4,12 @@
:: Created as part of cmder project :: Created as part of cmder project
:: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED :: !!! 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. :: Use /v command line arg or set to > 0 for verbose output to aid in debugging.
endlocal endlocal
set verbose-output=0 set verbose_output=0
set debug-output=0 set debug_output=0
set max_depth=1 set max_depth=1
set "CMDER_USER_FLAGS= " set "CMDER_USER_FLAGS= "
@ -39,9 +39,9 @@ call "%cmder_root%\vendor\lib\lib_profile"
if "%~1" == "" ( if "%~1" == "" (
goto :start goto :start
) else if /i "%1"=="/v" ( ) else if /i "%1"=="/v" (
set verbose-output=1 set verbose_output=1
) else if /i "%1"=="/d" ( ) else if /i "%1"=="/d" (
set debug-output=1 set debug_output=1
) else if /i "%1" == "/max_depth" ( ) else if /i "%1" == "/max_depth" (
if "%~2" geq "1" if "%~2" leq "5" ( if "%~2" geq "1" if "%~2" leq "5" (
set "max_depth=%~2" set "max_depth=%~2"
@ -60,7 +60,7 @@ call "%cmder_root%\vendor\lib\lib_profile"
) )
) else if /i "%1" == "/user_aliases" ( ) else if /i "%1" == "/user_aliases" (
if exist "%~2" ( if exist "%~2" (
set "user-aliases=%~2" set "user_aliases=%~2"
shift shift
) )
) else if /i "%1" == "/git_install_root" ( ) else if /i "%1" == "/git_install_root" (
@ -89,11 +89,13 @@ call "%cmder_root%\vendor\lib\lib_profile"
goto var_loop goto var_loop
:start :start
%lib_console% debug-output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" :: Sets CMDER_SHELL, CMDER_CLINK, CMDER_ALIASES
%lib_console% debug-output init.bat "Env Var - debug-output=%debug-output%" %lib_base% cmder_shell
%lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
%lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%"
if defined CMDER_USER_CONFIG ( 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 :: Pick right version of clink
@ -105,21 +107,25 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set architecture_bits=64 set architecture_bits=64
) )
:: Tell the user about the clink config files... if "%CMDER_CLINK%" == "1" (
if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( %lib_console% verbose_output "Injecting Clink!"
:: Run clink
if defined CMDER_USER_CONFIG (
if not exist "%CMDER_USER_CONFIG%\settings" (
echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
)
} else if not exist "%CMDER_ROOT%\config\settings" ( "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
) else (
if not exist "%CMDER_ROOT%\config\settings" (
echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. 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" "%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 :: Prepare for git-for-windows
@ -135,10 +141,10 @@ if not defined TERM set TERM=cygwin
:: also check that we have a recent enough version of git by examining the version string :: also check that we have a recent enough version of git by examining the version string
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
if defined GIT_INSTALL_ROOT ( 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..." %lib_console% debug_output init.bat "Looking for Git install root..."
:: get the version information for vendored git binary :: get the version information for vendored git binary
%lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd" %lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd"
@ -169,19 +175,18 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do (
set test_dir= set test_dir=
goto :FOUND_GIT goto :FOUND_GIT
) else ( ) 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= set test_dir=
) )
) else ( ) else (
:: if the user provided git executable is not found :: if the user provided git executable is not found
if !errorlevel! equ -255 ( 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= set test_dir=
) )
) )
) )
:: our last hope: our own git... :: our last hope: our own git...
@ -207,11 +212,15 @@ if defined GIT_INSTALL_ROOT (
:: define SVN_SSH so we can use git svn with ssh svn repositories :: define SVN_SSH so we can use git svn with ssh svn repositories
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') 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 "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 "Found Git in: '%GIT_INSTALL_ROOT%'"
goto :PATH_ENHANCE goto :PATH_ENHANCE
:NO_GIT :NO_GIT
@ -219,6 +228,7 @@ goto :PATH_ENHANCE
endlocal endlocal
:PATH_ENHANCE :PATH_ENHANCE
%lib_path% enhance_path "%CMDER_ROOT%\vendor\bin"
%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% %lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth%
if defined CMDER_USER_BIN ( if defined CMDER_USER_BIN (
%lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth% %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth%
@ -236,59 +246,63 @@ if defined CMDER_USER_CONFIG (
:: scripts run above by setting the 'aliases' env variable. :: scripts run above by setting the 'aliases' env variable.
:: ::
:: Note: If overriding default aliases store file the aliases :: 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. :: and be in profile.d folder.
if not defined user-aliases ( if not defined user_aliases (
if defined CMDER_USER_CONFIG ( if defined CMDER_USER_CONFIG (
set "user-aliases=%CMDER_USER_CONFIG%\user-aliases.cmd" set "user_aliases=%CMDER_USER_CONFIG%\user_aliases.cmd"
) else ( ) 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 if "%CMDER_ALIASES%" == "1" (
:: the default file to store new aliases in. REM The aliases environment variable is used by alias.bat to id
if not defined aliases ( REM the default file to store new aliases in.
set "aliases=%user-aliases%" 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 setlocal enabledelayedexpansion
if not exist "%user-aliases%" ( if not exist "%user_aliases%" (
echo Creating initial user-aliases store in "%user-aliases%"... echo Creating initial user_aliases store in "%user_aliases%"...
copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%" copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
) else ( ) else (
type "%user-aliases%" | findstr /i ";= Add aliases below here" >nul type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul
if "!errorlevel!" == "1" ( 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 ( if defined CMDER_USER_CONFIG (
copy "%user-aliases%" "%user-aliases%.old_format" copy "%user_aliases%" "%user_aliases%.old_format"
copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%" copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
) else ( ) else (
copy "%user-aliases%" "%user-aliases%.old_format" copy "%user_aliases%" "%user_aliases%.old_format"
copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%" 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" ( if exist "%CMDER_ROOT%\config\aliases" (
echo Updating old "%CMDER_ROOT%\config\aliases" to new format... 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%"
) else if exist "%user-aliases%.old_format" ( del "%CMDER_ROOT%\config\aliases"
echo Updating old "%user-aliases%" to new format... ) else if exist "%user_aliases%.old_format" (
type "%user-aliases%.old_format" >> "%user-aliases%" && del "%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
) )
endlocal
:: Add aliases to the environment :: Add aliases to the environment
call "%user-aliases%" call "%user_aliases%"
:: See vendor\git-for-windows\README.portable for why we do this :: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are :: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx :: manually extracting the archive rather than executing the 7z sfx
if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( 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%\" pushd "%GIT_INSTALL_ROOT%\"
"%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
popd popd
@ -296,19 +310,19 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
:: Set home path :: Set home path
if not defined HOME set "HOME=%USERPROFILE%" 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" set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
if exist "%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 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 ( if defined CMDER_USER_CONFIG (
set "initialConfig=%CMDER_USER_CONFIG%\user-profile.cmd" set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
if exist "%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 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"
) )
) )
@ -341,5 +355,19 @@ echo @echo off
) >"%initialConfig%" ) >"%initialConfig%"
) )
if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" (
echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd'
echo to get rid of this message either:
echo.
echo Delete the file '%CMDER_ROOT%\bin\alias.bat'
echo.
echo or
echo.
echo If you have customized it and want to continue using it instead of the included version
echo * Rename '%CMDER_ROOT%\bin\alias.bat' to '%CMDER_ROOT%\bin\alias.cmd'.
echo * Search for 'user-aliases' and replace it with 'user_aliases'.
)
set initialConfig= set initialConfig=
exit /b exit /b

View File

@ -43,3 +43,34 @@ exit /b
pause pause
exit /b 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% cmder_shell
:::.
:::options:
:::.
::: file <in> full path to file containing lib_routines to display
:::.
:::-------------------------------------------------------------------------------
echo %comspec% | find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd"
echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc"
echo %comspec% | find /i "\tccle" > nul && set "CMDER_SHELL=tccle"
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

View File

@ -13,9 +13,9 @@ if "%~1" == "/h" (
exit /b 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: :::include:
:::. :::.
@ -23,22 +23,22 @@ exit /b
:::. :::.
:::usage: :::usage:
:::. :::.
::: %lib_console% debug-output [caller] [message] ::: %lib_console% debug_output [caller] [message]
:::. :::.
:::required: :::required:
:::. :::.
::: [caller] <in> Script/sub routine name calling debug-output ::: [caller] <in> Script/sub routine name calling debug_output
:::. :::.
::: [message] <in> Message text to display. ::: [message] <in> 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 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: :::include:
:::. :::.
@ -46,7 +46,7 @@ exit /b
:::. :::.
:::usage: :::usage:
:::. :::.
::: %lib_console% verbose-output "[message]" ::: %lib_console% verbose_output "[message]"
:::. :::.
:::required: :::required:
:::. :::.
@ -54,7 +54,7 @@ exit /b
:::. :::.
:::------------------------------------------------------------------------------- :::-------------------------------------------------------------------------------
if %verbose-output% gtr 0 echo %~1 if %verbose_output% gtr 0 echo %~1
exit /b exit /b
:show_error :show_error

View File

@ -42,11 +42,11 @@ exit /b
:: set the executable path :: set the executable path
set "git_executable=%~2\git.exe" 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 :: check if the executable actually exists
if not exist "%git_executable%" ( 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 exit /b -255
) )
@ -54,7 +54,7 @@ exit /b
for /F "tokens=1,2,3 usebackq" %%A in (`"%git_executable%" --version 2^>nul`) do ( for /F "tokens=1,2,3 usebackq" %%A in (`"%git_executable%" --version 2^>nul`) do (
if /i "%%A %%B" == "git version" ( if /i "%%A %%B" == "git version" (
set "GIT_VERSION_%~1=%%C" 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 ( ) else (
%lib_console% show_error "git --version" returned an inproper version string! %lib_console% show_error "git --version" returned an inproper version string!
pause pause
@ -124,7 +124,7 @@ exit /b
call :parse_version %~1 %~2 call :parse_version %~1 %~2
:: ... and maybe display it, for debugging purposes. :: ... 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 exit /b
:compare_versions :compare_versions
@ -148,9 +148,9 @@ exit /b
:: checks all major, minor, patch and build variables for the given arguments. :: 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. :: 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 Comparing:
:: %lib_console% debug-output %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD! :: %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 %~2: !%~2_MAJOR!.!%~2_MINOR!.!%~2_PATCH!.!%~2_BUILD!
if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1) if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1)
if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1) if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1)

View File

@ -57,28 +57,28 @@ exit /b
set "find_query=%find_query: =\ %" set "find_query=%find_query: =\ %"
set found=0 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%\"$" echo "%path%"|findstr >nul /I /R ";%find_query%\"$"
if "!ERRORLEVEL!" == "0" set found=1 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" ( 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 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" ( 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" ( 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%" set "PATH=%PATH%;%add_path%"
) else ( ) else (
%lib_console% debug-output :enhance_path "Prepending '%add_path%'" %lib_console% debug_output :enhance_path "Prepending '%add_path%'"
set "PATH=%add_path%;%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:;;=;%" endlocal & set "PATH=%PATH:;;=;%"
@ -134,20 +134,20 @@ exit /b
if "%depth%" == "" set depth=0 if "%depth%" == "" set depth=0
%lib_console% debug-output :enhance_path_recursive "Env Var - add_path=%add_path%" %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%"
%lib_console% debug-output :enhance_path_recursive "Env Var - position=%position%" %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 - max_depth=%max_depth%"
if %max_depth% gtr !depth! ( if %max_depth% gtr !depth! (
%lib_console% debug-output :enhance_path_recursive "Adding parent directory - '%add_path%'" %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'"
call :enhance_path "%add_path%" %position% call :enhance_path "%add_path%" %position%
set /a "depth=!depth!+1" set /a "depth=!depth!+1"
for /d %%i in ("%add_path%\*") do ( 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 "Env Var BEFORE - depth=!depth!"
%lib_console% debug-output :enhance_path_recursive "Found Subdirectory - '%%~fi'" %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'"
call :enhance_path_recursive "%%~fi" %max_depth% %position% 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!"
) )
) )

View File

@ -39,7 +39,7 @@ exit /b
pushd "%~1" pushd "%~1"
for /f "usebackq" %%x in ( `dir /b *.bat *.cmd 2^>nul` ) do ( 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" call "%~1\%%x"
) )
popd popd

26
vendor/profile.ps1 vendored
View File

@ -2,7 +2,7 @@
# Created as part of cmder project # Created as part of cmder project
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED # !!! 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 # Compatibility with PS major versions <= 2
if(!$PSScriptRoot) { if(!$PSScriptRoot) {
@ -97,7 +97,7 @@ $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
# #
# Prompt Section # 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. # Pre assign the hooks so the first run of cmder gets a working prompt.
@ -134,7 +134,7 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
pushd $ENV:CMDER_ROOT\config\profile.d pushd $ENV:CMDER_ROOT\config\profile.d
foreach ($x in Get-ChildItem *.ps1) { foreach ($x in Get-ChildItem *.ps1) {
# write-host write-host Sourcing $x # write-host write-host Sourcing $x
. $x Import-Module $x
} }
popd popd
@ -144,23 +144,31 @@ if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profil
pushd $ENV:CMDER_USER_CONFIG\profile.d pushd $ENV:CMDER_USER_CONFIG\profile.d
foreach ($x in Get-ChildItem *.ps1) { foreach ($x in Get-ChildItem *.ps1) {
# write-host write-host Sourcing $x # write-host write-host Sourcing $x
. $x Import-Module $x
} }
popd 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) { if (Test-Path $CmderUserProfilePath) {
# Create this file and place your own command in there. # Create this file and place your own command in there.
. "$CmderUserProfilePath" Import-Module "$CmderUserProfilePath"
} }
if ($ENV:CMDER_USER_CONFIG) { 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) { if (Test-Path $CmderUserProfilePath) {
. "$CmderUserProfilePath" Import-Module "$CmderUserProfilePath"
} }
} }

8
vendor/sources.json vendored
View File

@ -1,8 +1,8 @@
[ [
{ {
"name": "git-for-windows", "name": "git-for-windows",
"version": "v2.17.1.windows.2", "version": "v2.19.0.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.17.1.windows.2/PortableGit-2.17.1.2-64-bit.7z.exe" "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", "name": "clink",
@ -11,8 +11,8 @@
}, },
{ {
"name": "conemu-maximus5", "name": "conemu-maximus5",
"version": "180528", "version": "180626",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v18.05.28/ConEmuPack.180528.7z" "url": "https://github.com/Maximus5/ConEmu/releases/download/v18.06.26/ConEmuPack.180626.7z"
}, },
{ {
"name": "clink-completions", "name": "clink-completions",