mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
Merge branch 'master' of github.com:cmderdev/cmder into git_clink_changes
This commit is contained in:
commit
16bf572cdf
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,6 +13,8 @@ vendor/*/*
|
||||
config/*
|
||||
!config/Readme.md
|
||||
|
||||
config_user/*
|
||||
|
||||
Thumbs.db
|
||||
*.exe
|
||||
*.dll
|
||||
|
168
CHANGELOG.md
168
CHANGELOG.md
@ -1,5 +1,173 @@
|
||||
# Change Log
|
||||
|
||||
## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22)
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix uncommenting `call ssh-agent` in `user_profile.cmd` breaks Cmder prompt. [#1990](https://github.com/cmderdev/cmder/issues/1990), [#1807](https://github.com/cmderdev/cmder/issues/1807), [#1785](https://github.com/cmderdev/cmder/issues/1785), [#1885](https://github.com/cmderdev/cmder/issues/1885)
|
||||
* Pull Request: [#1999](https://github.com/cmderdev/cmder/issues/1999) fix ssh-agent call in user_profile.cmd.default
|
||||
* Unable to use '%' character in git branch names [#1779](https://github.com/cmderdev/cmder/issues/1779)
|
||||
* Pull Request: [#1991](https://github.com/cmderdev/cmder/issues/1991) add percent escaping for string.gsub
|
||||
* sort command, unix vs windows (/usr/bin/sort vs sort.exe) [#1931](https://github.com/cmderdev/cmder/issues/1931)
|
||||
* Pull Request: [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option
|
||||
|
||||
### Adds
|
||||
|
||||
* [#1988](https://github.com/cmderdev/cmder/issues/1988) Prefer /nix_tools option
|
||||
* [#1982](https://github.com/cmderdev/cmder/issues/1982) make /register work with /single
|
||||
* [#1975](https://github.com/cmderdev/cmder/issues/1975) Add `/nix_tools 0` option to init.bat to prevent adding !GIT_INSTALL_ROOT!\usr\bin to PATH
|
||||
|
||||
|
||||
### Changes
|
||||
|
||||
* [#1987](https://github.com/cmderdev/cmder/issues/1987) Use default files for default user profiles
|
||||
|
||||
## [1.3.10](https://github.com/cmderdev/cmder/tree/v1.3.10) (2018-11-30)
|
||||
|
||||
### Fixes
|
||||
|
||||
* Replaces Cmder Release v1.3.9 which has been removed.
|
||||
* /c now completely separates user config including Conemu configuration. This enables true multi-user Cmder with no configuration collisions. See PR #1949.
|
||||
* Fix #1959 Start cmder "find" errors. See PR #1961.
|
||||
* Fix #1956 Git detection should use env from git install root. See PR #1969
|
||||
|
||||
### Adds
|
||||
|
||||
* /m initially creates %cmder_root%/config/conemu-%computername%.xml for users that want per computer Conemu configuration with shared init scripts. See PR #1949.
|
||||
* /register now recognizes /c [path] and creates an appropriate Cmder Here shell context menu. See PR #1949.
|
||||
|
||||
## [1.3.8](https://github.com/cmderdev/cmder/tree/v1.3.8) (2018-11-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix \vendor\bin\timer.cmd was unexpected at this time. on session start.
|
||||
|
||||
## [1.3.7](https://github.com/cmderdev/cmder/tree/v1.3.7) (2018-11-10)
|
||||
## Updated components
|
||||
|
||||
* ConEmu to 180626
|
||||
* Update Git to 2.19.0
|
||||
|
||||
## Fixes:
|
||||
|
||||
* Cmder now opens in the in the current working dir
|
||||
|
||||
## Commits
|
||||
### Aaron Arney (1):
|
||||
|
||||
* Update README
|
||||
|
||||
### Arion Roberto Krause (1):
|
||||
|
||||
* Fixed typo
|
||||
|
||||
### Benjamin Staneck (8):
|
||||
|
||||
* Revert "replace user-aliases with user_aliases"
|
||||
* replace user-aliases with user_aliases
|
||||
* better fix for #1265
|
||||
* Revert "sanitize dir before assigning to prompt"
|
||||
* sanitize dir before assigning to prompt
|
||||
* Update CHANGELOG.md
|
||||
|
||||
### Bob Hood (1):
|
||||
|
||||
* Refactored the Mercurial prompt code to be more efficient.
|
||||
|
||||
### David Refoua (1):
|
||||
|
||||
* fix some spelling issues
|
||||
|
||||
### Dax T Games (30):
|
||||
|
||||
* Revert "Ignore %cmder_root%\config (#1945)"
|
||||
* Ignore %cmder_root%\config (#1945)
|
||||
* Add /f for fast init. (#1942)
|
||||
* add diag helper scripts and adds to the path (#1918)
|
||||
* Fix #1806 #1675 (#1870)
|
||||
* Profile.ps1 (#1796)
|
||||
* Fix lib base (#1794)
|
||||
* Little Changes
|
||||
* Fixed move of default conemu.xml to the vendor folder
|
||||
* ignore all of config folder
|
||||
* move default comemu.xml to vendor folder
|
||||
* fixes
|
||||
* more headers
|
||||
* init.bat update for cexec
|
||||
* git prompt yellow
|
||||
* fix user lua and git detection
|
||||
* allow conditionally setting environment variables
|
||||
* added exit codes
|
||||
* flag_exists.cmd to flag_exec.cmd, also to lib as an option
|
||||
* fixed
|
||||
* handle start dir args with trailing "
|
||||
* cleanup
|
||||
* '.gitignore'
|
||||
* verbose output
|
||||
* cmder_shell settings
|
||||
* add cmder_shell method
|
||||
* replace - with \_ in debug-output and verbose-output
|
||||
* Trying to get tcc working
|
||||
* move user-aliases.cmd to user_aliases.cmd
|
||||
* move bin\alias.bat to vendor\bin\alias.cmd
|
||||
* fix /unregister
|
||||
|
||||
### Dmitri S. Guskov (2):
|
||||
|
||||
* Powershell 5.1 compatibility
|
||||
* Update profile.ps1
|
||||
|
||||
### Gregory Lucas (1):
|
||||
|
||||
* Initialize time_init to fix init error message
|
||||
|
||||
### Josef Pihrt (2):
|
||||
|
||||
* Fix typos, remove escaping inside inline code, replace single quote with backtick
|
||||
* Fix typo and broken link
|
||||
|
||||
### Merlin (1):
|
||||
|
||||
* Remove duplicate Install-Module detection
|
||||
|
||||
### Nicolas Arnaud-Cormos (1):
|
||||
|
||||
* Ensure the right git path is found in case of shim.
|
||||
|
||||
### Thorsten Sommer (1):
|
||||
|
||||
* Fixed spelling
|
||||
|
||||
### gaoslin (1):
|
||||
|
||||
* Update init.bat
|
||||
|
||||
### leochien0102 (1):
|
||||
|
||||
* fix the 'was unexpected at this time.'
|
||||
|
||||
### xiazeyu (4):
|
||||
|
||||
* chore: unite slash
|
||||
* docs: update to latest useage
|
||||
* refactor: reduce global varible useage, fixed quote issue, added parameters support
|
||||
* doc: fix typo
|
||||
|
||||
### xiazeyu_2011 (8):
|
||||
|
||||
* docs: migrated instructions to the wiki pages
|
||||
* rename /bin/have.bat to /vendor/lib/flag_exists.cmd
|
||||
* fix: bug when no argument is passed in
|
||||
* docs: update doc for have.bat
|
||||
* feat: add have.bat as a wrapper
|
||||
* Optimize comments of using arguments in user-profile.cmd
|
||||
* fix conflict with init.bat build-in command parser, update user-profile.cmd
|
||||
* Pass arguments to user-profile.cmd
|
||||
|
||||
刘祺 (1):
|
||||
|
||||
* add LANG support
|
||||
|
||||
## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30)
|
||||
**Updated components:**
|
||||
|
||||
|
16
README.md
16
README.md
@ -41,12 +41,15 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
|
||||
## Cmder.exe Command Line Arguments
|
||||
|
||||
|
||||
| Argument | Description |
|
||||
| ------------------- | ----------------------------------------------------------------------- |
|
||||
| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` |
|
||||
| `/SINGLE` | Start Cmder in single mode. |
|
||||
| `/START [start_path]` | Folder path to start in. |
|
||||
| `/TASK [task_name]` | Task to start after launch. |
|
||||
| Argument | Description |
|
||||
| ------------------- | ----------------------------------------------------------------------- |
|
||||
| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` |
|
||||
| `/M` | Use `conemu-%computername%.xml` for ConEmu settings storage instead of `user_conemu.xml` |
|
||||
| `/REGISTER [ALL, USER]` | Register a Windows Shell Menu shortcut. |
|
||||
| `/UNREGISTER [ALL, USER]` | Un-register a Windows Shell Menu shortcut. |
|
||||
| `/SINGLE` | Start Cmder in single mode. |
|
||||
| `/START [start_path]` | Folder path to start in. |
|
||||
| `/TASK [task_name]` | Task to start after launch. |
|
||||
|
||||
## Context Menu Integration
|
||||
|
||||
@ -146,6 +149,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/
|
||||
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` |
|
||||
| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` |
|
||||
| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
|
||||
| `/nix_tools [0-2]` | Define how `*nix` tools are added to the path. Prefer Windows Tools: 1, Prefer *nix Tools: 2, No `/usr/bin` in `%PATH%`: 0 | 1 |
|
||||
| `/svn_ssh [path to ssh.exe]` | Define `%SVN_SSH%` so we can use git svn with ssh svn repositories. | `%GIT_INSTALL_ROOT%\bin\ssh.exe` |
|
||||
| `/user_aliases [file path]` | File path pointing to user aliases. | `%CMDER_ROOT%\config\user-aliases.cmd` |
|
||||
| `/v` | Enables verbose output. | not set |
|
||||
|
@ -4,11 +4,12 @@ All config files must be in this folder. If there is no option to set this folde
|
||||
directly, it has to be hardlinked.
|
||||
|
||||
* `user-aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from
|
||||
`vendor\user-aliases.cmd.example`.
|
||||
`vendor\user-aliases.cmd.default`.
|
||||
* `*.lua`: clink completions and prompt filters; autoloaded after all
|
||||
prompt filter and clink completions are initialized; add your own.
|
||||
* `user-profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their
|
||||
respective startup scripts in `vendor\`; autocreated on first start of such a task.
|
||||
respective startup scripts in `vendor\`; autocreated from
|
||||
`vendor\user-profile.{sh|cmd|ps1}.default` on first start of such a task.
|
||||
* `.history`: the current commandline history; autoupdated on close.
|
||||
* `settings`: settings for readline; overwritten on update.
|
||||
* `ConEmu.xml`: settings from ConEmu (=the UI of cmder -> Preferences); overwritten on update.
|
||||
|
@ -69,7 +69,7 @@ bool FileExists(const wchar_t * filePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"")
|
||||
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true)
|
||||
{
|
||||
#if USE_TASKBAR_API
|
||||
wchar_t appId[MAX_PATH] = { 0 };
|
||||
@ -91,6 +91,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
wchar_t userAliasesPath[MAX_PATH] = { 0 };
|
||||
wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 };
|
||||
wchar_t args[MAX_PATH * 2 + 256] = { 0 };
|
||||
wchar_t userConEmuCfgPath[MAX_PATH] = { 0 };
|
||||
|
||||
|
||||
std::wstring cmderStart = path;
|
||||
std::wstring cmderTask = taskName;
|
||||
@ -147,7 +149,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
}
|
||||
|
||||
/*
|
||||
Was -c [path] specified?
|
||||
Was /c [path] specified?
|
||||
*/
|
||||
if (wcscmp(userConfigDirPath, L"") == 0)
|
||||
{
|
||||
@ -216,34 +218,86 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
// Set path to Cmder user ConEmu config file
|
||||
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
|
||||
if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it.
|
||||
if ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config.
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||
{
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
||||
{
|
||||
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
||||
else // '/c [path]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu.
|
||||
{
|
||||
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
||||
if (use_user_cfg == false && PathFileExists(cfgPath) && !PathFileExists(cpuCfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml");
|
||||
ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0]));
|
||||
}
|
||||
}
|
||||
else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
|
||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
||||
{
|
||||
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu.
|
||||
{
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
}
|
||||
}
|
||||
else if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||
{
|
||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
|
||||
{
|
||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
@ -253,15 +307,25 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
else // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml.
|
||||
{
|
||||
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
||||
{
|
||||
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
||||
else {
|
||||
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||
{
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -276,18 +340,20 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
}
|
||||
else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml.
|
||||
else // '/c [path]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'.
|
||||
{
|
||||
if ( ! CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||
if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE))
|
||||
{
|
||||
ShowErrorAndExit(GetLastError(), __WFUNCTION__, __LINE__);
|
||||
MessageBox(NULL,
|
||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied."
|
||||
: L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||
exit(1);
|
||||
}
|
||||
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||
}
|
||||
|
||||
SYSTEM_INFO sysInfo;
|
||||
@ -301,27 +367,26 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
||||
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe");
|
||||
}
|
||||
|
||||
swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder", args, icoPath);
|
||||
|
||||
if (!streqi(cmderStart.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str());
|
||||
}
|
||||
|
||||
if (is_single_mode)
|
||||
{
|
||||
if (!streqi(cmderTask.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str());
|
||||
}
|
||||
swprintf_s(args, L"%s /single", args);
|
||||
}
|
||||
else
|
||||
|
||||
if (!streqi(cmderTask.c_str(), L""))
|
||||
{
|
||||
if (!streqi(cmderTask.c_str(), L""))
|
||||
{
|
||||
swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str());
|
||||
}
|
||||
swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str());
|
||||
}
|
||||
|
||||
if (cfgRoot.length() != 0)
|
||||
{
|
||||
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||
}
|
||||
|
||||
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
||||
@ -387,8 +452,10 @@ HKEY GetRootKey(std::wstring opt)
|
||||
return root;
|
||||
}
|
||||
|
||||
void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
||||
void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgRoot, bool single)
|
||||
{
|
||||
wchar_t userConfigDirPath[MAX_PATH] = { 0 };
|
||||
|
||||
// First, get the paths we will use
|
||||
|
||||
wchar_t exePath[MAX_PATH] = { 0 };
|
||||
@ -397,7 +464,23 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
||||
GetModuleFileName(NULL, exePath, sizeof(exePath));
|
||||
|
||||
wchar_t commandStr[MAX_PATH + 20] = { 0 };
|
||||
swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath);
|
||||
wchar_t baseCommandStr[MAX_PATH + 20] = { 0 };
|
||||
if (!single) {
|
||||
swprintf_s(baseCommandStr, L"\"%s\"", exePath);
|
||||
}
|
||||
else {
|
||||
swprintf_s(baseCommandStr, L"\"%s\" /single", exePath);
|
||||
}
|
||||
|
||||
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||
{
|
||||
swprintf_s(commandStr, L"%s \"%%V\"", baseCommandStr);
|
||||
}
|
||||
else {
|
||||
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
||||
userConfigDirPath[cfgRoot.length()] = 0;
|
||||
swprintf_s(commandStr, L"%s /c \"%s\" \"%%V\"", baseCommandStr, userConfigDirPath);
|
||||
}
|
||||
|
||||
// Now that we have `commandStr`, it's OK to change `exePath`...
|
||||
PathRemoveFileSpec(exePath);
|
||||
@ -443,6 +526,7 @@ struct cmderOptions
|
||||
std::wstring cmderTask = L"";
|
||||
std::wstring cmderRegScope = L"USER";
|
||||
bool cmderSingle = false;
|
||||
bool cmderUserCfg = true;
|
||||
bool registerApp = false;
|
||||
bool unRegisterApp = false;
|
||||
bool error = false;
|
||||
@ -460,98 +544,105 @@ cmderOptions GetOption()
|
||||
{
|
||||
|
||||
// MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK);
|
||||
if (_wcsicmp(L"/c", szArgList[i]) == 0)
|
||||
{
|
||||
TCHAR userProfile[MAX_PATH];
|
||||
const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", userProfile, MAX_PATH);
|
||||
if (cmderOptions.error == false) {
|
||||
if (_wcsicmp(L"/c", szArgList[i]) == 0)
|
||||
{
|
||||
TCHAR userProfile[MAX_PATH];
|
||||
const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", userProfile, MAX_PATH);
|
||||
|
||||
wchar_t cmderCfgRoot[MAX_PATH] = { 0 };
|
||||
PathCombine(cmderCfgRoot, userProfile, L"cmder_cfg");
|
||||
wchar_t cmderCfgRoot[MAX_PATH] = { 0 };
|
||||
PathCombine(cmderCfgRoot, userProfile, L"cmder_cfg");
|
||||
|
||||
cmderOptions.cmderCfgRoot = cmderCfgRoot;
|
||||
cmderOptions.cmderCfgRoot = cmderCfgRoot;
|
||||
|
||||
if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/')
|
||||
{
|
||||
cmderOptions.cmderCfgRoot = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"/start", szArgList[i]) == 0)
|
||||
{
|
||||
int len = wcslen(szArgList[i + 1]);
|
||||
if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0)
|
||||
{
|
||||
szArgList[i + 1][len - 1] = '\0';
|
||||
}
|
||||
|
||||
if (PathFileExists(szArgList[i + 1]))
|
||||
{
|
||||
cmderOptions.cmderStart = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK);
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"/task", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.cmderTask = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (_wcsicmp(L"/single", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.cmderSingle = true;
|
||||
}
|
||||
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.registerApp = true;
|
||||
cmderOptions.unRegisterApp = false;
|
||||
if (szArgList[i + 1] != NULL)
|
||||
{
|
||||
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
||||
if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/')
|
||||
{
|
||||
cmderOptions.cmderRegScope = szArgList[i + 1];
|
||||
cmderOptions.cmderCfgRoot = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"/unregister", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.unRegisterApp = true;
|
||||
cmderOptions.registerApp = false;
|
||||
if (szArgList[i + 1] != NULL)
|
||||
else if (_wcsicmp(L"/start", szArgList[i]) == 0)
|
||||
{
|
||||
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
||||
int len = wcslen(szArgList[i + 1]);
|
||||
if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0)
|
||||
{
|
||||
cmderOptions.cmderRegScope = szArgList[i + 1];
|
||||
szArgList[i + 1][len - 1] = '\0';
|
||||
}
|
||||
|
||||
if (PathFileExists(szArgList[i + 1]))
|
||||
{
|
||||
cmderOptions.cmderStart = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cmderOptions.cmderStart == L"")
|
||||
{
|
||||
int len = wcslen(szArgList[i]);
|
||||
if (wcscmp(&szArgList[i][len - 1], L"\"") == 0)
|
||||
else if (_wcsicmp(L"/task", szArgList[i]) == 0)
|
||||
{
|
||||
szArgList[i][len - 1] = '\0';
|
||||
}
|
||||
|
||||
if (PathFileExists(szArgList[i]))
|
||||
{
|
||||
cmderOptions.cmderStart = szArgList[i];
|
||||
cmderOptions.cmderTask = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (_wcsicmp(L"/single", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.cmderSingle = true;
|
||||
}
|
||||
else if (_wcsicmp(L"/m", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.cmderUserCfg = false;
|
||||
}
|
||||
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.registerApp = true;
|
||||
cmderOptions.unRegisterApp = false;
|
||||
if (szArgList[i + 1] != NULL)
|
||||
{
|
||||
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
||||
{
|
||||
cmderOptions.cmderRegScope = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"/unregister", szArgList[i]) == 0)
|
||||
{
|
||||
cmderOptions.unRegisterApp = true;
|
||||
cmderOptions.registerApp = false;
|
||||
if (szArgList[i + 1] != NULL)
|
||||
{
|
||||
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
||||
{
|
||||
cmderOptions.cmderRegScope = szArgList[i + 1];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cmderOptions.cmderStart == L"")
|
||||
{
|
||||
int len = wcslen(szArgList[i]);
|
||||
if (wcscmp(&szArgList[i][len - 1], L"\"") == 0)
|
||||
{
|
||||
szArgList[i][len - 1] = '\0';
|
||||
}
|
||||
|
||||
if (PathFileExists(szArgList[i]))
|
||||
{
|
||||
cmderOptions.cmderStart = szArgList[i];
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||
cmderOptions.error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK);
|
||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||
cmderOptions.error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||
cmderOptions.error = true;
|
||||
}
|
||||
}
|
||||
|
||||
LocalFree(szArgList);
|
||||
@ -572,8 +663,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
if (cmderOptions.registerApp == true)
|
||||
{
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
|
||||
}
|
||||
else if (cmderOptions.unRegisterApp == true)
|
||||
{
|
||||
@ -586,7 +677,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot);
|
||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
8
vendor/bin/alias.cmd
vendored
8
vendor/bin/alias.cmd
vendored
@ -40,7 +40,7 @@ goto parseargument
|
||||
) else if "%currentarg%" neq "" (
|
||||
if "%~2" equ "" (
|
||||
:: Show the specified alias
|
||||
doskey /macros | findstr /b %currentarg%= && exit /b
|
||||
doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b
|
||||
echo insufficient parameters.
|
||||
goto :p_help
|
||||
) else (
|
||||
@ -85,7 +85,7 @@ if not ["%_temp%"] == ["%alias_name%"] (
|
||||
)
|
||||
|
||||
:: replace already defined alias
|
||||
findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||
%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
||||
doskey /macrofile="%ALIASES%"
|
||||
endlocal
|
||||
@ -93,7 +93,7 @@ exit /b
|
||||
|
||||
:p_del
|
||||
set del_alias=%~1
|
||||
findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||
%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
||||
doskey %del_alias%=
|
||||
doskey /macrofile="%ALIASES%"
|
||||
@ -105,7 +105,7 @@ echo Aliases reloaded
|
||||
exit /b
|
||||
|
||||
:p_show
|
||||
doskey /macros|findstr /v /r "^;=" | sort
|
||||
doskey /macros|%WINDIR%\System32\findstr /v /r "^;=" | sort
|
||||
exit /b
|
||||
|
||||
:p_help
|
||||
|
2
vendor/bin/cexec.cmd
vendored
2
vendor/bin/cexec.cmd
vendored
@ -52,7 +52,7 @@ set "feFlagName=%feFlagName% "
|
||||
:: echo %feCommand%
|
||||
:: echo %feParam%
|
||||
:: echo.
|
||||
echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul
|
||||
echo %CMDER_USER_FLAGS% | %WINDIR%\System32\find /i "%feFlagName%">nul
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
if "%feNOT%" == "false" (
|
||||
endlocal && call %feCommand% %feParam%
|
||||
|
39
vendor/clink.lua
vendored
39
vendor/clink.lua
vendored
@ -13,6 +13,14 @@ dofile(clink_lua_file)
|
||||
|
||||
-- now add our own things...
|
||||
|
||||
---
|
||||
-- Makes a string safe to use as the replacement in string.gsub
|
||||
---
|
||||
local function verbatim(s)
|
||||
s = string.gsub(s, "%%", "%%%%")
|
||||
return s
|
||||
end
|
||||
|
||||
---
|
||||
-- Setting the prompt in clink means that commands which rewrite the prompt do
|
||||
-- not destroy our own prompt. It also means that started cmds (or batch files
|
||||
@ -41,13 +49,12 @@ local function set_prompt_filter()
|
||||
-- color codes: "\x1b[1;37;40m"
|
||||
local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m"
|
||||
local lambda = "λ"
|
||||
cwd = string.gsub(cwd, "%%", "{percent}")
|
||||
cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd)
|
||||
cmder_prompt = string.gsub(cmder_prompt, "{cwd}", verbatim(cwd))
|
||||
|
||||
if env ~= nil then
|
||||
lambda = "("..env..") "..lambda
|
||||
end
|
||||
clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", lambda)
|
||||
clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", verbatim(lambda))
|
||||
end
|
||||
|
||||
local function percent_prompt_filter()
|
||||
@ -295,7 +302,7 @@ local function git_prompt_filter()
|
||||
color = colors.conflict
|
||||
end
|
||||
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..branch..")")
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
|
||||
return false
|
||||
end
|
||||
end
|
||||
@ -317,15 +324,19 @@ local function hg_prompt_filter()
|
||||
dirty = "\x1b[31;1m",
|
||||
}
|
||||
|
||||
-- 'hg id' gives us BOTH the branch name AND an indicator that there
|
||||
-- are uncommitted changes, in one fast(er) call
|
||||
local pipe = io.popen("hg id 2>&1")
|
||||
-- 'hg id -ib' gives us BOTH the branch name AND an indicator that there
|
||||
-- are uncommitted changes, in one fast(er) call compared to "hg status"
|
||||
local pipe = io.popen("hg id -ib 2>&1")
|
||||
local output = pipe:read('*all')
|
||||
local rc = { pipe:close() }
|
||||
|
||||
-- strip the trailing newline from the branch name
|
||||
local n = #output
|
||||
while n > 0 and output:find("^%s", n) do n = n - 1 end
|
||||
output = output:sub(1, n)
|
||||
|
||||
if output ~= nil and
|
||||
string.sub(output,1,7) ~= "abort: " and -- not an HG working copy
|
||||
string.sub(output,1,12) ~= "000000000000" and -- empty wc (needs update)
|
||||
(not string.find(output, "is not recognized")) then -- 'hg' not in path
|
||||
local color = colors.clean
|
||||
-- split elements on space delimiter
|
||||
@ -335,12 +346,16 @@ local function hg_prompt_filter()
|
||||
end
|
||||
-- if the repo hash ends with '+', the wc has uncommitted changes
|
||||
if string.sub(items[1], -1, -1) == "+" then color = colors.dirty end
|
||||
-- substitute the branch in directly -- already WITH parentheses. :)
|
||||
result = color .. items[2] -- string.sub(items[2], 1, string.len(items[2]) - 1)
|
||||
-- substitute the branch in directly
|
||||
if items[2] ~= nil then
|
||||
result = color .. "(" .. items[2] .. ")"
|
||||
else
|
||||
result = color .. "*"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", result)
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", verbatim(result))
|
||||
return false
|
||||
end
|
||||
|
||||
@ -362,7 +377,7 @@ local function svn_prompt_filter()
|
||||
color = colors.dirty
|
||||
end
|
||||
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..branch..")")
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..verbatim(branch)..")")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
7
vendor/cmder.sh
vendored
7
vendor/cmder.sh
vendored
@ -90,12 +90,7 @@ fi
|
||||
|
||||
if [ ! -f "${CmderUserProfilePath}" ] ; then
|
||||
echo Creating user startup file: "${CmderUserProfilePath}"
|
||||
cat <<-eof >"${CmderUserProfilePath}"
|
||||
# use this file to run your own startup commands for msys2 bash'
|
||||
|
||||
# To add a new vendor to the path, do something like:
|
||||
# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH}
|
||||
eof
|
||||
cp "${CMDER_ROOT}/vendor/user_profile.sh.default" "${CmderUserProfilePath}"
|
||||
fi
|
||||
|
||||
# Source the users .bashrc file if it exists
|
||||
|
7
vendor/cmder_exinit
vendored
7
vendor/cmder_exinit
vendored
@ -108,11 +108,6 @@ if [ ! "$CMDER_ROOT" = "" ] ; then
|
||||
|
||||
if [ ! -f "${CmderUserProfilePath}" ] ; then
|
||||
echo Creating user startup file: "${CmderUserProfilePath}"
|
||||
cat <<-eof >"${CmderUserProfilePath}"
|
||||
# use this file to run your own startup commands for msys2 bash'
|
||||
|
||||
# To add a new vendor to the path, do something like:
|
||||
# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH}
|
||||
eof
|
||||
cp "${CMDER_ROOT}/vendor/user_profile.sh.default" "${CmderUserProfilePath}"
|
||||
fi
|
||||
fi
|
||||
|
90
vendor/init.bat
vendored
90
vendor/init.bat
vendored
@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
set cmder_init_start=%time%
|
||||
set CMDER_INIT_START=%time%
|
||||
|
||||
:: Init Script for cmd.exe
|
||||
:: Created as part of cmder project
|
||||
@ -14,6 +14,8 @@ set debug_output=0
|
||||
set time_init=0
|
||||
set fast_init=0
|
||||
set max_depth=1
|
||||
:: Add *nix tools to end of path. 0 turns off *nix tools.
|
||||
set nix_tools=1
|
||||
set "CMDER_USER_FLAGS= "
|
||||
|
||||
:: Find root dir
|
||||
@ -79,6 +81,20 @@ call "%cmder_root%\vendor\lib\lib_profile"
|
||||
%lib_console% show_error "The Git install root folder "%~2", you specified does not exist!"
|
||||
exit /b
|
||||
)
|
||||
) else if /i "%1"=="/nix_tools" (
|
||||
if "%2" equ "0" (
|
||||
REM Do not add *nix tools to path
|
||||
set nix_tools=0
|
||||
shift
|
||||
) else if "%2" equ "1" (
|
||||
REM Add *nix tools to end of path
|
||||
set nix_tools=1
|
||||
shift
|
||||
) else if "%2" equ "2" (
|
||||
REM Add *nix tools to front of path
|
||||
set nix_tools=2
|
||||
shift
|
||||
)
|
||||
) else if /i "%1" == "/home" (
|
||||
if exist "%~2" (
|
||||
set "HOME=%~2"
|
||||
@ -235,19 +251,37 @@ goto :CONFIGURE_GIT
|
||||
:: Add git to the path
|
||||
if defined GIT_INSTALL_ROOT (
|
||||
rem add the unix commands at the end to not shadow windows commands like more
|
||||
if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" append
|
||||
if exist "!GIT_INSTALL_ROOT!\mingw32" (
|
||||
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" append
|
||||
) else if exist "!GIT_INSTALL_ROOT!\mingw64" (
|
||||
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" append
|
||||
if %nix_tools% equ 1 (
|
||||
%lib_console% debug_output init.bat "Preferring Windows commands"
|
||||
set "path_position=append"
|
||||
) else (
|
||||
%lib_console% debug_output init.bat "Preferring *nix commands"
|
||||
set "path_position="
|
||||
)
|
||||
|
||||
if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" !path_position!
|
||||
if exist "!GIT_INSTALL_ROOT!\mingw32" (
|
||||
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position!
|
||||
) else if exist "!GIT_INSTALL_ROOT!\mingw64" (
|
||||
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position!
|
||||
)
|
||||
|
||||
if %nix_tools% geq 1 (
|
||||
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position!
|
||||
)
|
||||
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" append
|
||||
|
||||
:: define SVN_SSH so we can use git svn with ssh svn repositories
|
||||
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
|
||||
|
||||
for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do (
|
||||
set "LANG=%%F"
|
||||
if not defined LANG (
|
||||
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
|
||||
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe"
|
||||
if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F")
|
||||
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale
|
||||
if not defined git_locale set git_locale=env /usr/bin/locale
|
||||
for /F "delims=" %%F in ('!git_locale! -uU 2') do (
|
||||
set "LANG=%%F"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -279,7 +313,7 @@ if defined CMDER_USER_CONFIG (
|
||||
:: scripts run above by setting the 'aliases' env variable.
|
||||
::
|
||||
:: Note: If overriding default aliases store file the aliases
|
||||
:: must also be self executing, see '.\user_aliases.cmd.example',
|
||||
:: must also be self executing, see '.\user_aliases.cmd.default',
|
||||
:: and be in profile.d folder.
|
||||
if not defined user_aliases (
|
||||
if defined CMDER_USER_CONFIG (
|
||||
@ -300,17 +334,17 @@ if "%CMDER_ALIASES%" == "1" (
|
||||
setlocal enabledelayedexpansion
|
||||
if not exist "%user_aliases%" (
|
||||
echo Creating initial user_aliases store in "%user_aliases%"...
|
||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
|
||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
|
||||
) else (
|
||||
type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul
|
||||
type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul
|
||||
if "!errorlevel!" == "1" (
|
||||
echo Creating initial user_aliases store in "%user_aliases%"...
|
||||
if defined CMDER_USER_CONFIG (
|
||||
copy "%user_aliases%" "%user_aliases%.old_format"
|
||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
|
||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
|
||||
) else (
|
||||
copy "%user_aliases%" "%user_aliases%.old_format"
|
||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
|
||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -348,6 +382,7 @@ if not defined HOME set "HOME=%USERPROFILE%"
|
||||
set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
|
||||
if exist "%CMDER_ROOT%\config\user_profile.cmd" (
|
||||
REM Create this file and place your own command in there
|
||||
%lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd"
|
||||
call "%CMDER_ROOT%\config\user_profile.cmd"
|
||||
)
|
||||
|
||||
@ -355,33 +390,14 @@ if defined CMDER_USER_CONFIG (
|
||||
set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
|
||||
if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
|
||||
REM Create this file and place your own command in there
|
||||
%lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd
|
||||
call "%CMDER_USER_CONFIG%\user_profile.cmd"
|
||||
)
|
||||
)
|
||||
|
||||
if not exist "%initialConfig%" (
|
||||
echo Creating user startup file: "%initialConfig%"
|
||||
(
|
||||
echo :: use this file to run your own startup commands
|
||||
echo :: use in front of the command to prevent printing the command
|
||||
echo.
|
||||
echo :: uncomment this to have the ssh agent load when cmder starts
|
||||
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
|
||||
echo.
|
||||
echo :: uncomment the next two lines to use pageant as the ssh authentication agent
|
||||
echo :: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock
|
||||
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-pageant.cmd"
|
||||
echo.
|
||||
echo :: you can add your plugins to the cmder path like so
|
||||
echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%"
|
||||
echo.
|
||||
echo :: arguments in this batch are passed from init.bat, you can quickly parse them like so:
|
||||
echo :: more useage can be seen by typing "cexec /?"
|
||||
echo.
|
||||
echo :: %%ccall%% "/customOption" "command/program"
|
||||
echo.
|
||||
echo @echo off
|
||||
) >"%initialConfig%"
|
||||
copy "%CMDER_ROOT%\vendor\user_profile.cmd.default" "%initialConfig%"
|
||||
)
|
||||
|
||||
if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" (
|
||||
@ -400,9 +416,9 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD
|
||||
set initialConfig=
|
||||
set CMDER_CONFIGURED=1
|
||||
|
||||
set cmder_init_end=%time%
|
||||
set CMDER_INIT_END=%time%
|
||||
|
||||
if %time_init% gtr 0 (
|
||||
"%cmder_root%\vendor\bin\timer.cmd" %cmder_init_start% %cmder_init_end%
|
||||
"%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END%
|
||||
)
|
||||
exit /b
|
||||
|
8
vendor/lib/lib_base.cmd
vendored
8
vendor/lib/lib_base.cmd
vendored
@ -27,7 +27,7 @@ exit /b
|
||||
::: file <in> full path to file containing lib_routines to display
|
||||
:::.
|
||||
:::-------------------------------------------------------------------------------
|
||||
for /f "tokens=* delims=:" %%a in ('type "%~1" ^| findstr /i /r "^:::"') do (
|
||||
for /f "tokens=* delims=:" %%a in ('type "%~1" ^| %WINDIR%\System32\findstr /i /r "^:::"') do (
|
||||
rem echo a="%%a"
|
||||
|
||||
if "%%a"=="." (
|
||||
@ -61,9 +61,9 @@ exit /b
|
||||
::: file <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"
|
||||
echo %comspec% | %WINDIR%\System32\find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd"
|
||||
echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc"
|
||||
echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle"
|
||||
|
||||
if not defined CMDER_CLINK (
|
||||
set CMDER_CLINK=1
|
||||
|
4
vendor/lib/lib_path.cmd
vendored
4
vendor/lib/lib_path.cmd
vendored
@ -68,14 +68,14 @@ exit /b
|
||||
|
||||
if "%CMDER_CONFIGURED%" == "1" (
|
||||
%lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%"
|
||||
echo "%path%"|findstr >nul /I /R ";%find_query%\"$"
|
||||
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R ";%find_query%\"$"
|
||||
if "!ERRORLEVEL!" == "0" set found=1
|
||||
)
|
||||
%lib_console% debug_output :enhance_path "Env Var 1 - found=!found!"
|
||||
|
||||
if "!found!" == "0" (
|
||||
if "%CMDER_CONFIGURED%" == "1" (
|
||||
echo "%path%"|findstr >nul /i /r ";%find_query%;"
|
||||
echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;"
|
||||
if "!ERRORLEVEL!" == "0" set found=1
|
||||
)
|
||||
%lib_console% debug_output :enhance_path "Env Var 2 - found=!found!"
|
||||
|
22
vendor/lib/start-ssh-agent.sh
vendored
Normal file
22
vendor/lib/start-ssh-agent.sh
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# Copied from https://help.github.com/articles/working-with-ssh-key-passphrases
|
||||
env=~/.ssh/agent.env
|
||||
|
||||
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
||||
|
||||
agent_start () {
|
||||
(umask 077; ssh-agent >| "$env")
|
||||
. "$env" >| /dev/null ; }
|
||||
|
||||
agent_load_env
|
||||
|
||||
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
||||
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
||||
|
||||
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
||||
agent_start
|
||||
ssh-add
|
||||
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
||||
ssh-add
|
||||
fi
|
||||
|
||||
unset env
|
55
vendor/profile.ps1
vendored
55
vendor/profile.ps1
vendored
@ -128,20 +128,30 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
|
||||
}
|
||||
|
||||
pushd $ENV:CMDER_ROOT\config\profile.d
|
||||
foreach ($x in Get-ChildItem *.ps1) {
|
||||
foreach ($x in Get-ChildItem *.psm1) {
|
||||
# write-host write-host Sourcing $x
|
||||
Import-Module $x
|
||||
}
|
||||
|
||||
foreach ($x in Get-ChildItem *.ps1) {
|
||||
# write-host write-host Sourcing $x
|
||||
. $x
|
||||
}
|
||||
popd
|
||||
|
||||
# Drop *.ps1 files into "$ENV:CMDER_USER_CONFIG\config\profile.d"
|
||||
# to source them at startup. Requires using cmder.exe /C [cmder_user_root_path] argument
|
||||
if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profile.d")) {
|
||||
pushd $ENV:CMDER_USER_CONFIG\profile.d
|
||||
foreach ($x in Get-ChildItem *.ps1) {
|
||||
foreach ($x in Get-ChildItem *.psm1) {
|
||||
# write-host write-host Sourcing $x
|
||||
Import-Module $x
|
||||
}
|
||||
|
||||
foreach ($x in Get-ChildItem *.ps1) {
|
||||
# write-host write-host Sourcing $x
|
||||
. $x
|
||||
}
|
||||
popd
|
||||
}
|
||||
|
||||
@ -153,7 +163,7 @@ if (test-path "$env:CMDER_ROOT\config\user-profile.ps1") {
|
||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user_profile.ps1"
|
||||
if (Test-Path $CmderUserProfilePath) {
|
||||
# Create this file and place your own command in there.
|
||||
Import-Module "$CmderUserProfilePath"
|
||||
. "$CmderUserProfilePath" # user_profile.ps1 is not a module DO NOT USE import-module
|
||||
}
|
||||
|
||||
if ($ENV:CMDER_USER_CONFIG) {
|
||||
@ -166,46 +176,13 @@ if ($ENV:CMDER_USER_CONFIG) {
|
||||
|
||||
$CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1"
|
||||
if (Test-Path $CmderUserProfilePath) {
|
||||
Import-Module "$CmderUserProfilePath"
|
||||
. "$CmderUserProfilePath" # user_profile.ps1 is not a module DO NOT USE import-module
|
||||
}
|
||||
}
|
||||
|
||||
if (! (Test-Path $CmderUserProfilePath) ) {
|
||||
# This multiline string cannot be indented, for this reason I've not indented the whole block
|
||||
|
||||
Write-Host -BackgroundColor Darkgreen -ForegroundColor White "First Run: Creating user startup file: $CmderUserProfilePath"
|
||||
|
||||
$UserProfileTemplate = @'
|
||||
# Use this file to run your own startup commands
|
||||
|
||||
## Prompt Customization
|
||||
<#
|
||||
.SYNTAX
|
||||
<PrePrompt><CMDER DEFAULT>
|
||||
λ <PostPrompt> <repl input>
|
||||
.EXAMPLE
|
||||
<PrePrompt>N:\Documents\src\cmder [master]
|
||||
λ <PostPrompt> |
|
||||
#>
|
||||
|
||||
[ScriptBlock]$PrePrompt = {
|
||||
|
||||
}
|
||||
|
||||
# Replace the cmder prompt entirely with this.
|
||||
# [ScriptBlock]$CmderPrompt = {}
|
||||
|
||||
[ScriptBlock]$PostPrompt = {
|
||||
|
||||
}
|
||||
|
||||
## <Continue to add your own>
|
||||
|
||||
|
||||
'@
|
||||
|
||||
New-Item -ItemType File -Path $CmderUserProfilePath -Value $UserProfileTemplate > $null
|
||||
|
||||
Write-Host -BackgroundColor Darkgreen -ForegroundColor White "First Run: Creating user startup file: $CmderUserProfilePath"
|
||||
Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath
|
||||
}
|
||||
|
||||
# Once Created these code blocks cannot be overwritten
|
||||
|
19
vendor/user_profile.cmd.default
vendored
Normal file
19
vendor/user_profile.cmd.default
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
:: use this file to run your own startup commands
|
||||
:: use in front of the command to prevent printing the command
|
||||
|
||||
:: uncomment this to have the ssh agent load when cmder starts
|
||||
:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" /k exit
|
||||
|
||||
:: uncomment the next two lines to use pageant as the ssh authentication agent
|
||||
:: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock
|
||||
:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-pageant.cmd"
|
||||
|
||||
:: you can add your plugins to the cmder path like so
|
||||
:: set "PATH=%CMDER_ROOT%\vendor\whatever;%PATH%"
|
||||
|
||||
:: arguments in this batch are passed from init.bat, you can quickly parse them like so:
|
||||
:: more useage can be seen by typing "cexec /?"
|
||||
|
||||
:: %ccall% "/customOption" "command/program"
|
||||
|
||||
@echo off
|
25
vendor/user_profile.ps1.default
vendored
Normal file
25
vendor/user_profile.ps1.default
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Use this file to run your own startup commands
|
||||
|
||||
## Prompt Customization
|
||||
<#
|
||||
.SYNTAX
|
||||
<PrePrompt><CMDER DEFAULT>
|
||||
λ <PostPrompt> <repl input>
|
||||
.EXAMPLE
|
||||
<PrePrompt>N:\Documents\src\cmder [master]
|
||||
λ <PostPrompt> |
|
||||
#>
|
||||
|
||||
[ScriptBlock]$PrePrompt = {
|
||||
|
||||
}
|
||||
|
||||
# Replace the cmder prompt entirely with this.
|
||||
# [ScriptBlock]$CmderPrompt = {}
|
||||
|
||||
[ScriptBlock]$PostPrompt = {
|
||||
|
||||
}
|
||||
|
||||
## <Continue to add your own>
|
||||
|
7
vendor/user_profile.sh.default
vendored
Normal file
7
vendor/user_profile.sh.default
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# use this file to run your own startup commands for msys2 bash'
|
||||
|
||||
# To add a new vendor to the path, do something like:
|
||||
# export PATH=${CMDER_ROOT}/vendor/whatever:${PATH}
|
||||
|
||||
# Uncomment this to have the ssh agent load with the first bash terminal
|
||||
# . "${CMDER_ROOT}/vendor/lib/start-ssh-agent.sh"
|
Loading…
Reference in New Issue
Block a user