diff --git a/.github/issue_template.md b/.github/issue_template.md index 064a3f4..5ebdb9c 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -4,7 +4,7 @@ ------------------------------------------------------------------ Please make sure you read and follow the following instructions - before reporting bugs, and/or requesting new features. + carefully before reporting bugs, and/or requesting new features. Make sure that you have: @@ -24,17 +24,22 @@ https://github.com/Maximus5/ConEmu/issues?q=is:issue - If there isn't an existing issue, you may open a new one. + If there isn't an existing issue, you may open a new one there. (We don't resolve issues regarding ConEmu here, so please make sure you open the issue in the correct place.) + + more info: https://conemu.github.io/en/ThirdPartyProblems.html - • If you are asking for Guides on how to integrate Cmder into + • If you are asking for guides on how to integrate Cmder into your favorite IDE of choice, or how to perform an specific - task with Cmder, make sure you visit our Guides section first: - - - https://github.com/cmderdev/cmder/issues?q=label:Guide - - https://github.com/cmderdev/cmder/issues?q=label:Question + task with Cmder, make sure you visit our label section first! + You may already have an answer under the Guides or Questions section. + + For a list of labels, visit: + - https://github.com/cmderdev/cmder/labels + + (Be sure to also check “Closed” issues in the labels section!) • If the issue is regarding the other upstream technologies that Cmder uses (e.g. Clink, Git, etc), please make sure that the @@ -42,6 +47,9 @@ combination with Cmder. If the bug applies when the mentioned tools are NOT used within Cmder, there's a good chance that you should open the bug at the corresponding repo instead. + + Read more on about Cmder on ConEmu docs: + https://conemu.github.io/en/cmder.html Thank you for making sure you are opening a new valid issue! @@ -56,6 +64,9 @@ - Post a screenshot or the command the triggered the problem, if applicable. - Avoid using ambiguous phrases like: doesn't work, there'a problem, etc. Help us reproduce the issue by explaining what went wrong, and what did you expect to happen. + - Please keep the ticket language to English only here. + We can't process your issue if it's written in Russian or Chinese as we can't understand them. + - ⚠ Read the following page to avoid posting a bad issue: https://conemu.github.io/en/BadIssue.html --> ### Purpose of the issue @@ -64,4 +75,4 @@ - [ ] Question ### Description of the issue - + diff --git a/.gitignore b/.gitignore index eb66319..96f5762 100644 --- a/.gitignore +++ b/.gitignore @@ -14,9 +14,11 @@ build/ Version v* *.bak config/user-* +config/user_* config/*.lua config/settings config/aliases config/profile.d .github_changelog_generator launcher/.vs +launcher/src/version.rc2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb69ea..aaf7120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [1.3.6](https://github.com/cmderdev/cmder/tree/v1.3.6) (2018-05-30) +**Updated components:** + +* Git updated to v2.17.1.windows.2 +* ConEmu updated to 180528 + +**Updates:** + +* Cmder now opens in the in the current working dir +* TBD + ## [1.3.6-pre2](https://github.com/cmderdev/cmder/tree/v1.3.6-pre2) (2018-03-01) **Updated components:** diff --git a/README.md b/README.md index 66f5220..b7e2f21 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,15 @@ Cmder is a **software package** created out of pure frustration over absence of The main advantage of Cmder is portability. It is designed to be totally self-contained with no external dependencies, which makes it great for **USB Sticks** or **cloud storage**. So you can carry your console, aliases and binaries (like wget, curl and git) with you anywhere. +The Cmder's user interface is also designed to be more eye pleasing, and you can compare the main differences between Cmder and ConEmu [here](https://conemu.github.io/en/cmder.html). + ## Installation ### Single User Portable Config 1. Download the [latest release](https://github.com/cmderdev/cmder/releases/) 2. Extract the archive. *Note: This path should not be `C:\Program Files` or anywhere else that would require Administrator access for modifying configuration files* 3. (optional) Place your own executable files into the `%cmder_root%\bin` folder to be injected into your PATH. -4. Run Cmder.exe +4. Run `Cmder.exe` ### Shared Cmder install with Non-Portable Individual User Config 1. Download the [latest release](https://github.com/cmderdev/cmder/releases/) @@ -24,7 +26,7 @@ The main advantage of Cmder is portability. It is designed to be totally self-co 3. (optional) Place your own executable files into the `%cmder_root%\bin` folder to be injected into your PATH. 4. (optional) Create `%userprofile%\cmder_config\bin` folder to be injected into individual users PATH. Default is to auto create this on first run. 5. (optional) Place your own executable files into the `%userprofile%\cmder_config\bin` folder to be injected into your PATH. -6. Run Cmder.exe with "/C" command line argument. Example: `cmder.exe /C %userprofile%\cmder_config` +6. Run `Cmder.exe` with `/C` command line argument. Example: `cmder.exe /C %userprofile%\cmder_config` * This will create the following directory structure if it is missing. ``` @@ -41,10 +43,10 @@ The main advantage of Cmder is portability. It is designed to be totally self-co | Argument | Description | | ------------------- | ----------------------------------------------------------------------- | -| /C [user_root_path] | Individual user Cmder root folder. Example: %userprofile%\cmder_config | -| /SINGLE | Start Cmder is single mode. | -| /START [start_path] | Folder path to start in. | -| /TASK [task_name] | Task to start after launch. | +| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` | +| `/SINGLE` | Start Cmder is single mode. | +| `/START [start_path]` | Folder path to start in. | +| `/TASK [task_name]` | Task to start after launch. | ## Context Menu Integration @@ -79,7 +81,7 @@ In a file explorer window right click in or on a directory to see "Cmder Here" i * Ctrl + R : History search * Shift + Mouse : Select and copy text from buffer -(Some shortcuts are not yet documented, though they exist - please document them here) +_(Some shortcuts are not yet documented, though they exist - please document them here)_ ## Features @@ -88,20 +90,24 @@ You can open multiple tabs each containing one of the following shells: | Task | Shell | Description | | ---- | ----- | ----------- | -| Cmder | cmd.exe | Windows 'cmd.exe' shell enhanced with Git, Git aware prompt, Clink(GNU Readline), and Aliases. | -| Cmder as Admin | cmd.exe | Administrative Windows 'cmd.exe' Cmder shell. | -| PowerShell | powershell.exe | Windows PowerShell enhanced with Git and Git aware prompt . | -| PowerShell as Admin | powershell.exe | Administrative Windows 'powershell.exe' Cmder shell. | -| Bash | bash.exe | Unix/Linux like bash shell running on Windows. | -| Bash as Admin | bash.exe | Administrative Unix/Linux like bash shell running on Windows. | -| Mintty | bash.exe | Unix/Linux like bash shell running on Windows. See below for Mintty configuration differences | -| Mintty as Admin | bash.exe | Administrative Unix/Linux like bash shell running on Windows. See below for Mintty configuration differences | +| Cmder | `cmd.exe` | Windows `cmd.exe` shell enhanced with Git, Git aware prompt, Clink (GNU Readline), and Aliases. | +| Cmder as Admin | `cmd.exe` | Administrative Windows 'cmd.exe' Cmder shell. | +| PowerShell | `powershell.exe` | Windows PowerShell enhanced with Git and Git aware prompt . | +| PowerShell as Admin | `powershell.exe` | Administrative Windows `powershell.exe` Cmder shell. | +| Bash | `bash.exe` | Unix/Linux like bash shell running on Windows. | +| Bash as Admin | `bash.exe` | Administrative Unix/Linux like bash shell running on Windows. | +| Mintty | `bash.exe` | Unix/Linux like bash shell running on Windows. See below for Mintty configuration differences | +| Mintty as Admin | `bash.exe` | Administrative Unix/Linux like bash shell running on Windows. See below for Mintty configuration differences | Cmder, PowerShell, and Bash tabs all run on top of the Windows Console API and work as you might expect in Cmder with access to use ConEmu's color schemes, key bindings and other settings defined in the ConEmu Settings dialog. -Mintty tabs use a program called 'mintty' as the terminal that is not based on the Windows Console API so some differences in functionality are normal, as a result mintty specific config is done via the '[%USERPROFILE%|$HOME]/.minttyrc' file. +⚠ *NOTE:* Only the full edition of Cmder comes with a pre-installed bash, using a vendored [git-for-windows](https://gitforwindows.org/) installation. The pre-configured Bash tabs may not work on Cmder mini eidition without additional configuration. -Mintty differs from the other tabs in that it supports xterm/xterm-256color TERM types, and does not work with ConEmu settings like color schemes and key bindings. For more on Mintty and its config click [here](https://github.com/mintty/mintty). +You may however, choose to use an external installation of bash, such as Microsoft's [Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) (called WSL) or the [Cygwin](https://cygwin.com/) project which provides POSIX support on windows. + +⚠ *NOTE:* Mintty tabs use a program called 'mintty' as the terminal emulator that is not based on the Windows Console API, rather it's rendered graphically by ConEmu. Mintty differs from the other tabs in that it supports xterm/xterm-256color TERM types, and does not work with ConEmu settings like color schemes and key bindings. As such, some differences in functionality are to be expected, such as Cmder not being able to apply a system-wide configuration to it. + +As a result mintty specific config is done via the `[%USERPROFILE%|$HOME]/.minttyrc` file. You may read more about Mintty and its config file [here](https://github.com/mintty/mintty). An example of setting Cmder portable terminal colors for mintty: @@ -111,10 +117,12 @@ From a bash/mintty shell: cd $CMDER_ROOT/vendor git clone https://github.com/karlin/mintty-colors-solarized.git cd mintty-colors-solarized/ -echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh>>$CMDER_ROOT/config/user-profile.sh +echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh>>$CMDER_ROOT/config/user_profile.sh ``` -### Changing Cmder Default 'cmd.exe' Shell Startup Behaviour Using Task Arguments +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). + +### Changing Cmder Default `cmd.exe` Shell Startup Behaviour Using Task Arguments 1. Press Win + Alt + T 1. Click either: @@ -132,36 +140,36 @@ echo source \$CMDER_ROOT/vendor/mintty-colors-solarized/mintty-solarized-dark.sh | Argument | Description | Default | | ----------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------- | -| /c [user cmder root] | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set | -| /d | Enables debug output. | not set | -| /git_install_root [file path] | User specified Git installation root path. | '%CMDER_ROOT%\vendor\Git-for-Windows' | -| /home [home folder] | User specified folder path to set `%HOME%` environment variable. | '%userprofile%' | -| /max_depth [1-5] | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 | -| /svn_ssh [path to ssh.exe] | Define %SVN_SSH% so we can use git svn with ssh svn repositories. | '%GIT_INSTALL_ROOT%\bin\ssh.exe' | -| /user_aliases [file path] | File path pointing to user aliases. | '%CMDER_ROOT%\config\user-liases.cmd' | -| /v | Enables verbose output. | not set | +| `/c [user cmder root]` | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set | +| `/d` | Enables debug output. | not set | +| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` | +| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` | +| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 | +| `/svn_ssh [path to ssh.exe]` | Define `%SVN_SSH%` so we can use git svn with ssh svn repositories. | `%GIT_INSTALL_ROOT%\bin\ssh.exe` | +| `/user_aliases [file path]` | File path pointing to user aliases. | `%CMDER_ROOT%\config\user-liases.cmd` | +| `/v` | Enables verbose output. | not set | ### Cmder Shell User Config Single user portable configuration is possible using the cmder specific shell config files. Edit the below files to add your own configuration: | Shell | Cmder Portable User Config | | ------------- | ----------------------------------------- | -| Cmder | %CMDER_ROOT%\\config\\user-profile.cmd | -| PowerShell | $ENV:CMDER_ROOT\\config\\user-profile.ps1 | -| Bash/Mintty | $CMDER_ROOT/config/user-profile.sh | +| Cmder | `%CMDER_ROOT%\\config\\user_profile.cmd` | +| PowerShell | `$ENV:CMDER_ROOT\\config\\user_profile.ps1` | +| Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` | -Note: Bash and Mintty sessions will also source the '$HOME/.bashrc' file if it exists after it sources '$CMDER_ROOT/config/user-profile.sh'. +Note: Bash and Mintty sessions will also source the `$HOME/.bashrc` file if it exists after it sources `$CMDER_ROOT/config/user_profile.sh`. -You can write *.cmd|*.bat, *.ps1, and *.sh scripts and just drop them in the %CMDER_ROOT%\config\profile.d folder to add startup config to Cmder. +You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in the `%CMDER_ROOT%\config\profile.d` folder to add startup config to Cmder. -| Shell | Cmder 'Profile.d' Scripts | +| Shell | Cmder `Profile.d` Scripts | | ------------- | --------------------------------------------------| -| Cmder | %CMDER_ROOT%\\config\\profile.d\\\*.bat and *.cmd | -| PowerShell | $ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1 | -| Bash/Mintty | $CMDER_ROOT/config/profile.d/*.sh | +| Cmder | `%CMDER_ROOT%\\config\\profile.d\\\*.bat and *.cmd` | +| PowerShell | `$ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1` | +| Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` | ### Aliases -#### Cmder(Cmd.exe) Aliases +#### Cmder(`Cmd.exe`) Aliases You can define simple aliases for `cmd.exe` sessions with a command like `alias name=command`. Cmd.exe aliases support optional parameters through the `$1-9` or the `$*` special characters so the alias `vi=vim.exe $*` typed as `vi [filename]` will open `[filename]` in `vim.exe`. Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for 'cmd.exe' @@ -170,40 +178,40 @@ Aliases defined using the `alias.bat` command will automatically be saved in the To make an alias and/or any other profile settings permanent add it to one of the following: -Note: These are loaded in this order by '$CMDER_ROOT/vendor/init.bat'. Anyhing stored in '%CMDER_ROOT%' will be a portable setting and will follow cmder to another machine. +Note: These are loaded in this order by `$CMDER_ROOT/vendor/init.bat`. Anything stored in `%CMDER_ROOT%` will be a portable setting and will follow cmder to another machine. -* '%CMDER_ROOT%\\config\\profile.d\\\*.cmd and \*.bat' -* '%CMDER_ROOT%\\config\\user-aliases.cmd' -* '%CMDER_ROOT%\\config\\user-profile.cmd' +* `%CMDER_ROOT%\\config\\profile.d\\\*.cmd` and `\*.bat` +* `%CMDER_ROOT%\\config\\user-aliases.cmd` +* `%CMDER_ROOT%\\config\\user_profile.cmd` #### Bash.exe|Mintty.exe Aliases Bash shells support simple and complex aliases with optional parameters natively so they work a little different. Typing `alias name=command` will create an alias only for the current running session. 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/git-for-windows/etc/profile.d/cmder.sh'. 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/git-for-windows/etc/profile.d/cmder.sh`. Anything stored in `$CMDER_ROOT` will be a portable setting and will follow cmder to another machine. -* '$CMDER_ROOT/config/profile.d/*.sh' -* '$CMDER_ROOT/config/user-profile.sh' -* '$HOME/.bashrc' +* `$CMDER_ROOT/config/profile.d/*.sh` +* `$CMDER_ROOT/config/user_profile.sh` +* `$HOME/.bashrc` -If you add bash aliases to `$CMDER_ROOT/config/user-profile.sh` they will be portable and follow your Cmder folder if you copy it to another machine. `$HOME/.bashrc` defined aliases are not portable. +If you add bash aliases to `$CMDER_ROOT/config/user_profile.sh` they will be portable and follow your Cmder folder if you copy it to another machine. `$HOME/.bashrc` defined aliases are not portable. #### PowerShell.exe Aliases PowerShell has native simple alias support, for example `[new-alias | set-alias] alias command`, so complex aliases with optional parameters are not supported in PowerShell sessions. Type `get-help [new-alias|set-alias] -full` for help on PowerShell aliases. To make an alias and/or any other profile settings permanent add it to one of the following: -Note: These are loaded in this order by '$ENV:CMDER_ROOT\\vendor\\user-profile.ps1'. Anyhing stored in '$ENV:CMDER_ROOT' will be a portable setting and will follow cmder to another machine. +Note: These are loaded in this order by `$ENV:CMDER_ROOT\\vendor\\user_profile.ps1`. Anything stored in `$ENV:CMDER_ROOT` will be a portable setting and will follow cmder to another machine. * '$ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1' -* '$ENV:CMDER_ROOT\\config\\user-profile.ps1' +* '$ENV:CMDER_ROOT\\config\\user_profile.ps1' ### SSH Agent To start the vendored SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-for-windows/cmd` folder. -If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"` in `%CMDER_ROOT%/config/user-profile.cmd` (usually just uncomment it). +If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"` in `%CMDER_ROOT%/config/user_profile.cmd` (usually just uncomment it). ### Vendored Git @@ -211,24 +219,26 @@ Cmder is by default shipped with a vendored Git installation. On each instance You may use your favorite version of Git by including its path in the `%PATH%` enviroment variable. Moreover, the **Mini** edition of Cmder (found on the [downloads page](https://github.com/cmderdev/cmder/releases)) excludes any vendored Git binaries. -### Using external Cygwin/Babun, MSys2, or Git for Windows SDK with Cmder. +### Using external Cygwin/Babun, MSys2, WSL, or Git for Windows SDK with Cmder. -1. Setup a new task by pressing 'Win +Alt + T'. -1. Click the '+' button to add a task. +You may run bash (the default shell used on Linux, macOS and GNU/Hurd) externally on Cmder, using the following instructions: + +1. Setup a new task by pressing Win +Alt + T. +1. Click the `+` button to add a task. 1. Name the new task in the top text box. 1. Provide task parameters, this is optional. -1. Add ```cmd /c "[path_to_external_env]\bin\bash --login -i" -new_console``` to the `Commands` text box. +1. Add `cmd /c "[path_to_external_env]\bin\bash --login -i" -new_console` to the `Commands` text box. -Recommended Optional Steps: +**Recommended Optional Steps:** -Copy the 'vendor/cmder_exinit' file to the Cygwin/Babun, MSys2, or Git for Windows SDK environments ```/etc/profile.d/``` folder to use portable settings in the $CMDER_ROOT/config folder. +Copy the `vendor/cmder_exinit` file to the Cygwin/Babun, MSys2, or Git for Windows SDK environments `/etc/profile.d/` folder to use portable settings in the `$CMDER_ROOT/config` folder. -Note: MinGW could work if the init scripts include profile.d but this has not been tested. +Note: MinGW could work if the init scripts include `profile.d` but this has not been tested. The destination file extension depends on the shell you use in that environment. For example: -* bash - Copy to /etc/profile.d/cmder_exinit.sh -* zsh - Copy to /etc/profile.d/cmder_exinit.zsh +* bash - Copy to `/etc/profile.d/cmder_exinit.sh` +* zsh - Copy to `/etc/profile.d/cmder_exinit.zsh` Uncomment and edit the below line in the script to use Cmder config even when launched from outside Cmder. @@ -236,9 +246,16 @@ Uncomment and edit the below line in the script to use Cmder config even when la # CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. ``` +### Integrating Cmder with [Hyper](https://github.com/zeit/hyper), [Microsoft VS Code](https://code.visualstudio.com/), and your favorite IDEs +Cmder by default comes with a vendored ConEmu installation as the underlying terminal emulator, as stated [here](https://conemu.github.io/en/cmder.html). + +However, Cmder can in fact run in a variety of other terminal emulators, and even integrated IDEs. Assuming you have the latest version of Cmder, follow the following instructions to get Cmder working with your own terminal emulator. + +For instructions on how to integrate Cmder with your IDE, please read our [Wiki section](https://github.com/cmderdev/cmder/wiki#cmder-integration). + ## Upgrading -The process of upgrading Cmder depends on the version/build you are currently running +The process of upgrading Cmder depends on the version/build you are currently running. If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer version of Cmder, follow the below process: @@ -248,7 +265,7 @@ If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer ver 2. Exit all Cmder sessions and backup any files you have manually edited under `[cmder_root]/vendor`. - * Editing files under `[cmder_root]/vendor` is not recommended since you will need to re-apply these changes after any upgrade. All user customizations should go in '[cmder_root]/config' folder. + * Editing files under `[cmder_root]/vendor` is not recommended since you will need to re-apply these changes after any upgrade. All user customizations should go in `[cmder_root]/config` folder. 3. Delete the `[cmder_root]/vendor` folder. 4. Extract the new `cmder.zip` or `cmder_mini.zip` into `[cmder_root]/` overwriting all files when prompted. @@ -259,7 +276,7 @@ If you do not have a `[cmder_root]/config/user-conemu.xml`, you are running an o 2. Backup any files you have manually edited under `[cmder_root]/vendor`. - * Editing files under `[cmder_root]/vendor` is not recommended since you will need to re-apply these changes after any upgrade. All user customizations should go in '[cmder_root]/config' folder. + * Editing files under `[cmder_root]/vendor` is not recommended since you will need to re-apply these changes after any upgrade. All user customizations should go in `[cmder_root]/config` folder. 3. Delete the `[cmder_root]/vendor` folder. 4. Extract the new `cmder.zip` or `cmder_mini.zip` into `[cmder_root]/` overwriting all files when prompted. diff --git a/config/ConEmu.xml b/config/ConEmu.xml index ef62ad0..c4f4fff 100644 --- a/config/ConEmu.xml +++ b/config/ConEmu.xml @@ -59,6 +59,7 @@ + @@ -507,7 +508,7 @@ - + @@ -516,8 +517,8 @@ - - + + @@ -527,7 +528,7 @@ - + @@ -536,10 +537,10 @@ - + - + @@ -548,14 +549,14 @@ - + - + diff --git a/launcher/CmderLauncher.vcxproj b/launcher/CmderLauncher.vcxproj index 879bb5a..08deaeb 100644 --- a/launcher/CmderLauncher.vcxproj +++ b/launcher/CmderLauncher.vcxproj @@ -1,4 +1,4 @@ - + @@ -61,6 +61,9 @@ Windows true + + src/app.manifest %(AdditionalManifestFiles) + _USING_V110_SDK71_;%(PreprocessorDefinitions) @@ -84,6 +87,9 @@ true true + + src/app.manifest %(AdditionalManifestFiles) + copy $(TargetPath) $(SolutionDir)..\$(TargetFileName) diff --git a/launcher/src/CmderLauncher.cpp b/launcher/src/CmderLauncher.cpp index bb62614..bfb7918 100644 --- a/launcher/src/CmderLauncher.cpp +++ b/launcher/src/CmderLauncher.cpp @@ -9,6 +9,7 @@ #include #pragma comment(lib, "Shlwapi.lib") +#pragma warning( disable : 4091 ) #ifndef UNICODE #error "Must be compiled with unicode support." @@ -85,6 +86,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr wchar_t userConfigDirPath[MAX_PATH] = { 0 }; wchar_t userBinDirPath[MAX_PATH] = { 0 }; wchar_t userProfiledDirPath[MAX_PATH] = { 0 }; + wchar_t userProfilePath[MAX_PATH] = { 0 }; + wchar_t legacyUserProfilePath[MAX_PATH] = { 0 }; wchar_t args[MAX_PATH * 2 + 256] = { 0 }; std::wstring cmderStart = path; @@ -104,6 +107,21 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(icoPath, exeDir, L"icons\\cmder.ico"); PathCombine(configDirPath, exeDir, L"config"); + + PathCombine(legacyUserProfilePath, configDirPath, L"user-profile.cmd"); + if (PathFileExists(legacyUserProfilePath)) { + PathCombine(userProfilePath, configDirPath, L"user_profile.cmd"); + + char *lPr = (char *)malloc(MAX_PATH); + char *pR = (char *)malloc(MAX_PATH); + size_t i; + wcstombs_s(&i, lPr, (size_t)MAX_PATH, + legacyUserProfilePath, (size_t)MAX_PATH); + wcstombs_s(&i, pR, (size_t)MAX_PATH, + userProfilePath, (size_t)MAX_PATH); + rename(lPr, pR); + } + if (wcscmp(userConfigDirPath, L"") == 0) { PathCombine(userConfigDirPath, exeDir, L"config"); @@ -118,6 +136,20 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr PathCombine(userProfiledDirPath, userConfigDirPath, L"profile.d"); SHCreateDirectoryEx(0, userProfiledDirPath, 0); + + PathCombine(legacyUserProfilePath, userConfigDirPath, L"user-profile.cmd"); + if (PathFileExists(legacyUserProfilePath)) { + PathCombine(userProfilePath, userConfigDirPath, L"user_profile.cmd"); + + char *lPr = (char *)malloc(MAX_PATH); + char *pR = (char *)malloc(MAX_PATH); + size_t i; + wcstombs_s(&i, lPr, (size_t)MAX_PATH, + legacyUserProfilePath, (size_t)MAX_PATH); + wcstombs_s(&i, pR, (size_t)MAX_PATH, + userProfilePath, (size_t)MAX_PATH); + rename(lPr, pR); + } } // Set path to vendored ConEmu config file @@ -131,7 +163,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0])); PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml"); - if (PathFileExists(cpuCfgPath)) { if (PathFileExists(cfgPath)) { if (!CopyFile(cfgPath, cpuCfgPath, FALSE)) @@ -334,6 +365,7 @@ void UnregisterShellMenu(std::wstring opt, wchar_t* keyBaseName) HKEY cmderKey; // FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL)); FAIL_ON_ERROR(RegDeleteTree(cmderKey, NULL)); + RegDeleteKeyEx(root, keyBaseName, KEY_ALL_ACCESS, NULL); RegCloseKey(cmderKey); RegCloseKey(root); } @@ -385,7 +417,7 @@ cmderOptions GetOption() i++; } else { - MessageBox(NULL, szArgList[i + 1], L"/START - Folder doses not exist!", MB_OK); + MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK); } } else if (_wcsicmp(L"/task", szArgList[i]) == 0) diff --git a/launcher/src/Resource.rc b/launcher/src/Resource.rc index 9d4ec33..55e2772 100644 Binary files a/launcher/src/Resource.rc and b/launcher/src/Resource.rc differ diff --git a/launcher/src/app.manifest b/launcher/src/app.manifest new file mode 100644 index 0000000..bf133f7 --- /dev/null +++ b/launcher/src/app.manifest @@ -0,0 +1,54 @@ + + + + + + Cmder Console Emulator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + + diff --git a/launcher/src/version.rc2.sample b/launcher/src/version.rc2.sample new file mode 100644 index 0000000..003621d --- /dev/null +++ b/launcher/src/version.rc2.sample @@ -0,0 +1,27 @@ + +/** + * WARNING: do NOT modify this file! the content of this file should be + * automatically genereted before AppVeyor builds using the + * respective .ps1 Powershell scripts. + * + */ + +///////////////////////////////////////////////////////////////////////////// +// Define the version numbers and build information manually here: + +#define CMDER_MAJOR_VERSION {Cmder-Major-Version} +#define CMDER_MINOR_VERSION {Cmder-Minor-Version} +#define CMDER_REVISION_VERSION {Cmder-Revision-Version} +#define CMDER_BUILD_VERSION {Cmder-Build-Version} +#define CMDER_VERSION_STR {Cmder-Version-Str} + +#define CMDER_PRODUCT_NAME_STR "Cmder" +#define CMDER_FILE_DESCRIPTION_STR "Cmder: Lovely Console Emulator." +#define CMDER_INTERNAL_NAME_STR "Cmder" +#define CMDER_ORIGINAL_FILENAME_STR "Cmder.exe" +#define CMDER_COMPANY_NAME_STR "Samuel Vasko" +#define CMDER_COPYRIGHT_YEAR_STR "2016" + +#define CMDER_DEBUGFLAG 0x0L // set to 0x1L to enable debug mode +#define CMDER_BUILDFLAGS 0x0L +///////////////////////////////////////////////////////////////////////////// diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 62eb4e5..7a78a85 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -58,12 +58,15 @@ $ScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition $cmder_root = $ScriptRoot.replace("\scripts","") # Dot source util functions into this scope -. ".\utils.ps1" +. "$PSScriptRoot\utils.ps1" $ErrorActionPreference = "Stop" Push-Location -Path $saveTo $sources = Get-Content $sourcesPath | Out-String | Convertfrom-Json +# Get the version string +$version = Get-VersionStr + # Check for requirements Ensure-Exists $sourcesPath Ensure-Executable "7z" @@ -116,10 +119,17 @@ Pop-Location if($Compile) { Push-Location -Path $launcher - msbuild CmderLauncher.vcxproj /p:configuration=Release + Create-RC $version ($launcher + '\src\version.rc2'); + msbuild CmderLauncher.vcxproj /t:Clean,Build /p:configuration=Release if ($LastExitCode -ne 0) { throw "msbuild failed to build the executable." } + else { + Write-Verbose "successfully built Cmder v$version!" + if ( $Env:APPVEYOR -eq 'True' ) { + Add-AppveyorMessage -Message "Building Cmder v$version was successful." -Category Information + } + } Pop-Location } else { Write-Warning "You are not building a launcher, Use -Compile" diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 1b76a67..8382d5f 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -48,7 +48,7 @@ $targets = @{ Delete-Existing "..\Version*" Delete-Existing "..\build\*" -$version = Invoke-Expression "git describe --abbrev=0 --tags" +$version = Get-VersionStr (New-Item -ItemType file "$cmderRoot\Version $version") | Out-Null foreach ($t in $targets.GetEnumerator()) { diff --git a/scripts/utils.ps1 b/scripts/utils.ps1 index e3a47fc..fe5aa47 100644 --- a/scripts/utils.ps1 +++ b/scripts/utils.ps1 @@ -62,6 +62,85 @@ function Digest-Hash($path) { return Invoke-Expression "md5sum $path" } +function Get-VersionStr() { + + # Clear existing variable + if ($string) { Clear-Variable -name string } + + # Determine if git is available + if (Get-Command "git.exe" -ErrorAction SilentlyContinue) + { + + # Determine if the current diesctory is a git repository + $GitPresent = Invoke-Expression "git rev-parse --is-inside-work-tree" -erroraction SilentlyContinue + + if ( $GitPresent -eq 'true' ) + { + $string = Invoke-Expression "git describe --abbrev=0 --tags" + } + + } + + # Fallback used when Git is not available + if ( -not($string) ) + { + $string = Parse-Changelog ($PSScriptRoot + '\..\' + 'CHANGELOG.md') + } + + # Add build number, if AppVeyor is present + if ( $Env:APPVEYOR -eq 'True' ) + { + $string = $string + '.' + $Env:APPVEYOR_BUILD_NUMBER + } + + # Remove starting 'v' characters + $string = $string -replace '^v+','' # normalize version string + + return $string + +} + +function Parse-Changelog($file) { + + # Define the regular expression to match the version string from changelog + [regex]$regex = '^## \[(?[\w\-\.]+)\]\([^\n()]+\)\s+\([^\n()]+\)$'; + + # Find the first match of the version string which means the latest version + $version = Select-String -Path $file -Pattern $regex | Select-Object -First 1 | % { $_.Matches.Groups[1].Value } + + return $version +} + +function Create-RC($string, $path) { + + $version = $string + '.0.0.0.0' # padding for version string + + if ( !(Test-Path "$path.sample") ) { + throw "Invalid path provided for resources file." + } + + $resource = Get-Content -Path "$path.sample" + $pattern = @( "Cmder-Major-Version", "Cmder-Minor-Version", "Cmder-Revision-Version", "Cmder-Build-Version" ) + $index = 0 + + # Replace all non-numeric characters to dots and split to array + $version = $version -replace '[^0-9]+','.' -split '\.' + + foreach ($fragment in $version) { + if ( !$fragment ) { break } + elseif ($index -le $pattern.length) { + $resource = $resource.Replace( "{" + $pattern[$index++] + "}", $fragment ) + } + } + + # Add the version string + $resource = $resource.Replace( "{Cmder-Version-Str}", '"' + $string + '"' ) + + # Write the results + Set-Content -Path $path -Value $resource + +} + function Register-Cmder() { [CmdletBinding()] Param @@ -121,6 +200,8 @@ function Download-File { $Url, $File ) + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + # I think this is the problem $File = $File -Replace "/", "\" Write-Verbose "Downloading from $Url to $File" diff --git a/vendor/clink.lua b/vendor/clink.lua index e692951..35acb73 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -41,13 +41,19 @@ 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) + if env ~= nil then lambda = "("..env..") "..lambda end clink.prompt.value = string.gsub(cmder_prompt, "{lamb}", lambda) end +local function percent_prompt_filter() + clink.prompt.value = string.gsub(clink.prompt.value, "{percent}", "%%") +end + --- -- Resolves closest directory location for specified directory. -- Navigates subsequently up one level and tries to find specified directory @@ -235,7 +241,7 @@ end -- Get the status of working dir -- @return {bool} --- -function get_svn_status() +local function get_svn_status() local file = io.popen("svn status -q") for line in file:lines() do file:close() @@ -340,6 +346,7 @@ clink.prompt.register_filter(set_prompt_filter, 1) clink.prompt.register_filter(hg_prompt_filter, 50) clink.prompt.register_filter(git_prompt_filter, 50) clink.prompt.register_filter(svn_prompt_filter, 50) +clink.prompt.register_filter(percent_prompt_filter, 51) local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/' for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do diff --git a/vendor/cmder.sh b/vendor/cmder.sh index fc4d009..aa59642 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -1,10 +1,10 @@ # DO NOT EDIT THIS FILE IT WILL BE OVERWRITTEN ON UPDATE # -# Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh, +# Add portable user customizations ${CMDER_ROOT}/config/user_profile.sh, # these customizations will follow Cmder if $CMDER_ROOT is copied # to another machine. # -# Add system specific users customizations to $HOME/.bashrc, these +# Add system specific users customizations to $HOME/.bashrc, these # customizations will not follow Cmder to another machine. function runProfiled { @@ -14,7 +14,7 @@ function runProfiled { if [ ! "x${profile_d_scripts}" = "x" ] ; then for x in ${profile_d_scripts} ; do - echo Sourcing "${1}/${x}"... + # echo Sourcing "${1}/${x}"... . "${1}/${x}" done fi @@ -63,21 +63,32 @@ if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then runProfiled "${CMDER_USER_CONFIG}/profile.d" fi -if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then - . "${CMDER_ROOT}/config/user-profile.sh" + +# Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. +if [ -f "$CMDER_ROOT/config/user-profile.sh" ] ; then + mv "$CMDER_ROOT/config/user-profile.sh" "$CMDER_ROOT/config/user_profile.sh" fi -if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then - . "${CMDER_USER_CONFIG}/user-profile.sh" -else - if [ "${CMDER_USER_CONFIG}" != "" ] ; then - initialProfile="${CMDER_USER_CONFIG}/user-profile.sh" - else - initialProfile="${CMDER_ROOT}/config/user-profile.sh" - fi +CmderUserProfilePath="${CMDER_ROOT}/config/user_profile.sh" +if [ -f "${CMDER_ROOT}/config/user_profile.sh" ] ; then + . "${CMDER_ROOT}/config/user_profile.sh" +fi - echo Creating user startup file: "${initialProfile}" - cat <<-eof >"${initialProfile}" +if [ "${CMDER_USER_CONFIG}" != "" ] ; then + # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. + if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then + mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" + fi + + CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" + if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then + . "${CMDER_USER_CONFIG}/user_profile.sh" + fi +fi + +if [ ! -f "${CmderUserProfilePath}" ] ; then + echo Creating user startup file: "${CmderUserProfilePath}" + cat <<-eof >"${CmderUserProfilePath}" # use this file to run your own startup commands for msys2 bash' # To add a new vendor to the path, do something like: diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index f20bef1..c182aee 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -1,4 +1,4 @@ -# Copy this file to your non integrated *nix-like environment, +# Copy this file to your non integrated *nix-like environment, # Cygwin/MSys2/Git for Windows SDK, installs '/etc/profile.d/' # folder to integrate the externally installed Unix like environment # into Cmder so it has access to settings stored in Cmder/config @@ -15,7 +15,7 @@ # These customizations will follow Cmder if $CMDER_ROOT is copied # to another machine. # -# Add system specific users customizations to $HOME/.bashrc, these +# Add system specific users customizations to $HOME/.bashrc, these # customizations will not follow Cmder to another machine. # # Uncomment and edit the CMDER_ROOT line to use Cmder/config even when launched @@ -58,45 +58,55 @@ fi if [ ! "$CMDER_ROOT" = "" ] ; then # Remove any trailing '/' CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::') - + echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"." - + export CMDER_ROOT - + PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT} - + export PATH - + # Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" # to source them at startup. if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then mkdir -p "${CMDER_ROOT}/config/profile.d" fi - + if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then runProfiled "${CMDER_ROOT}/config/profile.d" fi - + if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then runProfiled "${CMDER_USER_CONFIG}/profile.d" fi - - if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then - . "${CMDER_ROOT}/config/user-profile.sh" + + # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. + if [ -f "$CMDER_ROOT/config/user-profile.sh" ] ; then + mv "$CMDER_ROOT/config/user-profile.sh" "$CMDER_ROOT/config/user_profile.sh" fi - - if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then - . "${CMDER_USER_CONFIG}/user-profile.sh" - else - if [ "${CMDER_USER_CONFIG}" != "" ] ; then - initialProfile="${CMDER_USER_CONFIG}/user-profile.sh" - else - initialProfile="${CMDER_ROOT}/config/user-profile.sh" - fi - - echo Creating user startup file: "${initialProfile}" - cat <<-eof >"${initialProfile}" + + CmderUserProfilePath="${CMDER_ROOT}/config/user_profile.sh" + if [ -f "${CMDER_ROOT}/config/user_profile.sh" ] ; then + . "${CMDER_ROOT}/config/user_profile.sh" + fi + + if [ "${CMDER_USER_CONFIG}" != "" ] ; then + # Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency. + if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then + mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh" + fi + + CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh" + if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then + . "${CMDER_USER_CONFIG}/user_profile.sh" + fi + fi + + if [ ! -f "${CmderUserProfilePath}" ] ; then + echo Creating user startup file: "${CmderUserProfilePath}" + cat <<-eof >"${CmderUserProfilePath}" # use this file to run your own startup commands for msys2 bash' # To add a new vendor to the path, do something like: diff --git a/vendor/init.bat b/vendor/init.bat index a4d9e09..bf0b120 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -4,7 +4,7 @@ :: Created as part of cmder project :: !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED -:: !!! Use "%CMDER_ROOT%\config\user-profile.cmd" to add your own startup commands +:: !!! Use "%CMDER_ROOT%\config\user_profile.cmd" to add your own startup commands :: Use /v command line arg or set to > 0 for verbose output to aid in debugging. set verbose-output=0 @@ -36,11 +36,11 @@ call "%cmder_root%\vendor\lib\lib_profile" :var_loop if "%~1" == "" ( goto :start - ) else if "%1"=="/v" ( + ) else if /i "%1"=="/v" ( set verbose-output=1 - ) else if "%1"=="/d" ( + ) else if /i "%1"=="/d" ( set debug-output=1 - ) else if "%1" == "/max_depth" ( + ) else if /i "%1" == "/max_depth" ( if "%~2" geq "1" if "%~2" leq "5" ( set "max_depth=%~2" shift @@ -48,7 +48,7 @@ call "%cmder_root%\vendor\lib\lib_profile" %lib_console% show_error "'/max_depth' requires a number between 1 and 5!" exit /b ) - ) else if "%1" == "/c" ( + ) else if /i "%1" == "/c" ( if exist "%~2" ( if not exist "%~2\bin" mkdir "%~2\bin" set "cmder_user_bin=%~2\bin" @@ -56,12 +56,12 @@ call "%cmder_root%\vendor\lib\lib_profile" set "cmder_user_config=%~2\config" shift ) - ) else if "%1" == "/user_aliases" ( + ) else if /i "%1" == "/user_aliases" ( if exist "%~2" ( set "user-aliases=%~2" shift ) - ) else if "%1" == "/git_install_root" ( + ) else if /i "%1" == "/git_install_root" ( if exist "%~2" ( set "GIT_INSTALL_ROOT=%~2" shift @@ -69,7 +69,7 @@ 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 "%1" == "/home" ( + ) else if /i "%1" == "/home" ( if exist "%~2" ( set "HOME=%~2" shift @@ -77,7 +77,7 @@ call "%cmder_root%\vendor\lib\lib_profile" %lib_console% show_error The home folder "%2", you specified does not exist! exit /b ) - ) else if "%1" == "/svn_ssh" ( + ) else if /i "%1" == "/svn_ssh" ( set SVN_SSH=%2 shift ) @@ -129,12 +129,14 @@ if not defined TERM set TERM=cygwin :: * test if a git is in path and if yes, use that :: * last, use our vendored git :: also check that we have a recent enough version of git by examining the version string +setlocal enabledelayedexpansion if defined GIT_INSTALL_ROOT ( if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :FOUND_GIT) ) +%lib_console% debug-output init.bat "Looking for Git install root..." + :: get the version information for vendored git binary -setlocal enabledelayedexpansion %lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd" %lib_git% validate_version VENDORED !GIT_VERSION_VENDORED! @@ -182,7 +184,7 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :VENDORED_GIT if exist "%CMDER_ROOT%\vendor\git-for-windows" ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" ) else ( goto :NO_GIT ) @@ -197,18 +199,26 @@ if defined GIT_INSTALL_ROOT ( ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64" append ) - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" append + %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^>nul') do ( + set "LANG=%%F" + ) ) -:NO_GIT -endlocal & set "PATH=%PATH%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" +endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" %lib_console% debug-output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" +%lib_console% debug-output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" +goto :PATH_ENHANCE -:: Enhance Path -%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% +:NO_GIT +:: Skip this if GIT WAS FOUND else we did 'endlocal' above! +endlocal + +:PATH_ENHANCE +%lib_path% enhance_path_recursive "%CMDER_ROOT%\bin" %max_depth% if defined CMDER_USER_BIN ( %lib_path% enhance_path_recursive "%CMDER_USER_BIN%" %max_depth% ) @@ -287,16 +297,22 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( if not defined HOME set "HOME=%USERPROFILE%" %lib_console% debug-output init.bat "Env Var - HOME=%HOME%" -if exist "%CMDER_ROOT%\config\user-profile.cmd" ( +set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" +if exist "%CMDER_ROOT%\config\user_profile.cmd" ( REM Create this file and place your own command in there - call "%CMDER_ROOT%\config\user-profile.cmd" + call "%CMDER_ROOT%\config\user_profile.cmd" ) -if defined CMDER_USER_CONFIG if exist "%CMDER_USER_CONFIG%\user-profile.cmd" ( - REM Create this file and place your own command in there - call "%CMDER_USER_CONFIG%\user-profile.cmd" -) else ( - echo Creating user startup file: "%CMDER_ROOT%\config\user-profile.cmd" +if defined CMDER_USER_CONFIG ( + set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd" + if exist "%CMDER_USER_CONFIG%\user_profile.cmd" ( + REM Create this file and place your own command in there + call "%CMDER_USER_CONFIG%\user_profile.cmd" + ) +) + +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 @@ -312,13 +328,8 @@ echo :: you can add your plugins to the cmder path like so echo :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%" echo. echo @echo off -) >"%temp%\user-profile.tmp" - - if defined CMDER_USER_CONFIG ( - copy "%temp%\user-profile.tmp" "%CMDER_USER_CONFIG%\user-profile.cmd" - ) else ( - copy "%temp%\user-profile.tmp" "%CMDER_ROOT%\config\user-profile.cmd" - ) +) >"%initialConfig%" ) +set initialConfig= exit /b diff --git a/vendor/lib/lib_base.cmd b/vendor/lib/lib_base.cmd index 6ab50e8..37a1072 100644 --- a/vendor/lib/lib_base.cmd +++ b/vendor/lib/lib_base.cmd @@ -3,7 +3,7 @@ set lib_base=call "%~dp0lib_base.cmd" if "%~1" == "/h" ( - %lib_base% help "%0" + %lib_base% help "%~0" ) else if "%1" neq "" ( call :%* ) @@ -16,7 +16,7 @@ exit /b :::. :::include: :::. -::: call "$0" +::: call "lib_base.cmd" :::. :::usage: :::. @@ -27,12 +27,9 @@ exit /b ::: file full path to file containing lib_routines to display :::. :::------------------------------------------------------------------------------- - for /f "tokens=* delims=:" %%a in ('type "%~1" ^| findstr /i /r "^:::"') do ( rem echo a="%%a" - if "%%a"==" " ( - echo. if "%%a"=="." ( echo. ) else if /i "%%a" == "usage" ( diff --git a/vendor/lib/lib_console.cmd b/vendor/lib/lib_console.cmd index 38f40b4..4de7525 100644 --- a/vendor/lib/lib_console.cmd +++ b/vendor/lib/lib_console.cmd @@ -6,7 +6,7 @@ call "%~dp0lib_base.cmd" set lib_console=call "%~dp0lib_console.cmd" if "%~1" == "/h" ( - %lib_base% help "%0" + %lib_base% help "%~0" ) else if "%1" neq "" ( call :%* ) @@ -19,7 +19,7 @@ exit /b :::. :::include: :::. -::: call "$0" +::: call "lib_console.cmd" :::. :::usage: :::. @@ -76,5 +76,4 @@ exit /b :::------------------------------------------------------------------------------- echo ERROR: %~1 - echo CMDER Shell Initialization has Failed! exit /b diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index 7ff9562..d703e58 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -7,7 +7,7 @@ set lib_git=call "%~dp0lib_git.cmd" if "%~1" == "/h" ( - %lib_base% help "%0" + %lib_base% help "%~0" ) else if "%1" neq "" ( call :%* ) @@ -20,7 +20,7 @@ exit /b :::. :::include: :::. -::: call "$0" +::: call "lib_git.cmd" :::. :::usage: :::. @@ -46,7 +46,7 @@ exit /b :: check if the executable actually exists if not exist "%git_executable%" ( - %lib_console% show_error "%git_executable%" does not exist! + %lib_console% debug-output :read_version "%git_executable% does not exist." exit /b -255 ) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 7cd08a7..1d8c9e7 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -6,7 +6,7 @@ call "%%~dp0lib_console" set lib_path=call "%~dp0lib_path.cmd" if "%~1" == "/h" ( - %lib_base% help "%0" + %lib_base% help "%~0" ) else if "%1" neq "" ( call :%* ) @@ -19,7 +19,7 @@ exit /b ::: :::include: ::: -::: call "$0" +::: call "lib_path.cmd" ::: :::usage: ::: diff --git a/vendor/lib/lib_profile.cmd b/vendor/lib/lib_profile.cmd index 77eebf8..82dbb4a 100644 --- a/vendor/lib/lib_profile.cmd +++ b/vendor/lib/lib_profile.cmd @@ -6,7 +6,7 @@ call "%%~dp0lib_console" set lib_profile=call "%~dp0lib_profile.cmd" if "%~1" == "/h" ( - %lib_base% help "%0" + %lib_base% help "%~0" ) else if "%1" neq "" ( call :%* ) @@ -19,7 +19,7 @@ exit /b ::: :::include: ::: -::: call "$0" +::: call "lib_profile.cmd" ::: :::usage: ::: diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index f8360a2..8c9f207 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -2,7 +2,7 @@ # Created as part of cmder project # !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED -# !!! Use "%CMDER_ROOT%\config\user-profile.ps1" to add your own startup commands +# !!! Use "%CMDER_ROOT%\config\user_profile.ps1" to add your own startup commands # Compatibility with PS major versions <= 2 if(!$PSScriptRoot) { @@ -97,7 +97,7 @@ $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT" # # Prompt Section -# Users should modify their user-profile.ps1 as it will be safe from updates. +# Users should modify their user_profile.ps1 as it will be safe from updates. # # Pre assign the hooks so the first run of cmder gets a working prompt. @@ -134,37 +134,45 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) { pushd $ENV:CMDER_ROOT\config\profile.d foreach ($x in Get-ChildItem *.ps1) { # write-host write-host Sourcing $x - . $x + Import-Module $x } popd # 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 -not (test-path "$ENV:CMDER_USER_CONFIG\profile.d")) { +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) { # write-host write-host Sourcing $x - . $x + Import-Module $x } popd } +# Renaming to "config\user_profile.ps1" to "user_profile.ps1" for consistency. +if (test-path "$env:CMDER_ROOT\config\user-profile.ps1") { + rename-item "$env:CMDER_ROOT\config\user-profile.ps1" user_profile.ps1 +} - -$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1" +$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user_profile.ps1" if (Test-Path $CmderUserProfilePath) { # Create this file and place your own command in there. - . "$CmderUserProfilePath" - + Import-Module "$CmderUserProfilePath" } if ($ENV:CMDER_USER_CONFIG) { - $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user-profile.ps1" + # Renaming to "$env:CMDER_USER_CONFIG\user-profile.ps1" to "user_profile.ps1" for consistency. + if (test-path "$env:CMDER_USER_CONFIG\user-profile.ps1") { + rename-item "$env:CMDER_USER_CONFIG\user-profile.ps1" user_profile.ps1 + } + + $CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1" + if (Test-Path $CmderUserProfilePath) { + Import-Module "$CmderUserProfilePath" + } } -if (Test-Path $CmderUserProfilePath) { - . "$CmderUserProfilePath" -} else { +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" diff --git a/vendor/sources.json b/vendor/sources.json index a30657d..437a4ee 100644 --- a/vendor/sources.json +++ b/vendor/sources.json @@ -1,8 +1,8 @@ [ { "name": "git-for-windows", - "version": "v2.16.3.windows.1", - "url": "https://github.com/git-for-windows/git/releases/download/v2.16.3.windows.1/PortableGit-2.16.3-64-bit.7z.exe" + "version": "v2.17.1.windows.2", + "url": "https://github.com/git-for-windows/git/releases/download/v2.17.1.windows.2/PortableGit-2.17.1.2-64-bit.7z.exe" }, { "name": "clink", @@ -11,8 +11,8 @@ }, { "name": "conemu-maximus5", - "version": "180318", - "url": "https://github.com/Maximus5/ConEmu/releases/download/v18.03.18/ConEmuPack.180318.7z" + "version": "180528", + "url": "https://github.com/Maximus5/ConEmu/releases/download/v18.05.28/ConEmuPack.180528.7z" }, { "name": "clink-completions",