mirror of
https://github.com/cmderdev/cmder.git
synced 2025-07-17 04:59:09 +08:00
Compare commits
96 Commits
Author | SHA1 | Date | |
---|---|---|---|
a49c1b3f3d | |||
fff6e4506c | |||
a71c6a50ad | |||
5e703796c9 | |||
b88a01822f | |||
3bf07c088d | |||
724930d69d | |||
badb027c24 | |||
145a1b144b | |||
29c5e83975 | |||
1c02c55c2f | |||
74fc14eadf | |||
0729c06c20 | |||
6da96fb7ec | |||
ba610f5f7b | |||
7930c9bfe5 | |||
bafaf7cba4 | |||
3c14d19a27 | |||
13941a44ec | |||
ee4f85de85 | |||
9d6e5c12a2 | |||
da27f9be9f | |||
124565f36a | |||
46d468aea0 | |||
dc27c53739 | |||
7479d620b1 | |||
a8d32611a9 | |||
b6042a7ca1 | |||
dcf22af3c8 | |||
b58ff9bb53 | |||
68d9425c89 | |||
a95cd140ef | |||
e90966c5c2 | |||
e104f20c5d | |||
6883ba3b84 | |||
1c1c08bb68 | |||
a5eb4d7b4f | |||
d88f1b0a97 | |||
8d74184d30 | |||
3ea6d51ba4 | |||
22d27afed5 | |||
e9a78a30d1 | |||
e92f7fbb55 | |||
7ca2f5503a | |||
a34e17f2bd | |||
1f9e743ef2 | |||
f687281be0 | |||
4c270699a1 | |||
b45e3adc67 | |||
8077c1a612 | |||
d9fcf06e0f | |||
815b99b98b | |||
bcb60f8f59 | |||
0877a6d995 | |||
71f5b446da | |||
512787f391 | |||
262d92265e | |||
409b92aac2 | |||
aea1a977bf | |||
a7237370e3 | |||
25005930ba | |||
74d79ea628 | |||
89c014bb05 | |||
c19237085d | |||
9c4e77b498 | |||
c2cf56cc48 | |||
6e2d88d466 | |||
cd3efdf382 | |||
53c7ec5886 | |||
e63368fe96 | |||
aa2eaa6886 | |||
bee82d00e8 | |||
02366fdc7e | |||
399999d7f7 | |||
8eea2baaa5 | |||
4d3950174f | |||
24a110ddb7 | |||
1dd0e600ac | |||
e49b978b9a | |||
9182c89a14 | |||
00622254a7 | |||
9977c0563d | |||
b604bf0b6c | |||
3b0a51d7b8 | |||
018cc9ceda | |||
ad0f8fe049 | |||
7f4a4d34d6 | |||
963a5a8be6 | |||
f04a4e4846 | |||
50ed66894f | |||
2bb5ce0986 | |||
3b7a24b20a | |||
81d83d4c6d | |||
61849dc7fd | |||
9f2c0e4001 | |||
4195b5b0ed |
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,6 +13,8 @@ build/
|
|||||||
Version v*
|
Version v*
|
||||||
*.bak
|
*.bak
|
||||||
config/user-*
|
config/user-*
|
||||||
|
config/settings
|
||||||
config/aliases
|
config/aliases
|
||||||
config/profile.d
|
config/profile.d
|
||||||
.github_changelog_generator
|
.github_changelog_generator
|
||||||
|
launcher/.vs
|
||||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Samuel Vasko
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
68
README.md
68
README.md
@ -1,6 +1,6 @@
|
|||||||
# Cmder
|
# Cmder
|
||||||
|
|
||||||
[](https://gitter.im/cmderdev/cmder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://ci.appveyor.com/project/MartiUK/cmder)
|
[](https://gitter.im/cmderdev/cmder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://ci.appveyor.com/project/MartiUK/cmder)
|
||||||
|
|
||||||
Cmder is a **software package** created out of pure frustration over absence of usable console emulator on Windows. It is based on [ConEmu](https://conemu.github.io/) with *major* config overhaul, comes with a Monokai color scheme, amazing [clink](https://github.com/mridgers/clink) (further enhanced by [clink-completions](https://github.com/vladimir-kotikov/clink-completions)) and a custom prompt layout.
|
Cmder is a **software package** created out of pure frustration over absence of usable console emulator on Windows. It is based on [ConEmu](https://conemu.github.io/) with *major* config overhaul, comes with a Monokai color scheme, amazing [clink](https://github.com/mridgers/clink) (further enhanced by [clink-completions](https://github.com/vladimir-kotikov/clink-completions)) and a custom prompt layout.
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ The main advantage of Cmder is portability. It is designed to be totally self-co
|
|||||||
|
|
||||||
1. Download the [latest release](https://github.com/cmderdev/cmder/releases/)
|
1. Download the [latest release](https://github.com/cmderdev/cmder/releases/)
|
||||||
2. Extract the archive
|
2. Extract the archive
|
||||||
3. (optional) Place your own executable files into the `bin` folder to be injected into your PATH
|
3. (optional) Place your own executable files into the `bin` folder to be injected into your PATH. (nb: This path should not be `C:\Program Files` or anywhere else that would require Administrator access for modifying configuration files)
|
||||||
4. Run Cmder.exe
|
4. Run Cmder.exe
|
||||||
|
|
||||||
## Integration
|
## Integration
|
||||||
@ -38,6 +38,9 @@ In a file explorer window right click in or on a directory to see "Cmder Here" i
|
|||||||
* <kbd>Ctrl</kbd> + <kbd>W</kbd> : Close tab
|
* <kbd>Ctrl</kbd> + <kbd>W</kbd> : Close tab
|
||||||
* <kbd>Ctrl</kbd> + <kbd>D</kbd> : Close tab (if pressed on empty command)
|
* <kbd>Ctrl</kbd> + <kbd>D</kbd> : Close tab (if pressed on empty command)
|
||||||
* <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>#Number</kbd> : Fast new tab: <kbd>1</kbd> - CMD, <kbd>2</kbd> - PowerShell
|
* <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>#Number</kbd> : Fast new tab: <kbd>1</kbd> - CMD, <kbd>2</kbd> - PowerShell
|
||||||
|
* <kbd>Ctrl</kbd> + <kbd>Tab</kbd> : Switch to next tab
|
||||||
|
* <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Tab</kbd> : Switch to previous tab
|
||||||
|
* <kbd>Ctrl</kbd> + <kbd>#Number</kbd> : Switch to tab #Number
|
||||||
* <kbd>Alt</kbd> + <kbd>Enter</kbd>: Fullscreen
|
* <kbd>Alt</kbd> + <kbd>Enter</kbd>: Fullscreen
|
||||||
|
|
||||||
### Shell
|
### Shell
|
||||||
@ -109,16 +112,39 @@ You can define simple aliases for `cmd.exe` sessions with a command like `alias
|
|||||||
|
|
||||||
Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for 'cmd.exe'
|
Cmd.exe aliases can also be more complex. See: [DOSKEY.EXE documentation](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=true) for additional details on complex aliases/macros for 'cmd.exe'
|
||||||
|
|
||||||
Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\aliases` file
|
Aliases defined using the `alias.bat` command will automatically be saved in the `%CMDER_ROOT%\config\user-aliases.cmd` file
|
||||||
|
|
||||||
|
To make an alias and/or any other profile settings permanent add it to one of the following:
|
||||||
|
|
||||||
|
Note: These are loaded in this order by '$CMDER_ROOT/vendor/init.bat'. Anyhing 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'
|
||||||
|
|
||||||
#### Bash.exe|Mintty.exe Aliases
|
#### Bash.exe|Mintty.exe Aliases
|
||||||
Bash shells support simple and complex aliases with optional parameters natively so they work a little different. Typing `alias name=command` will create an alias only for the current running session. To make an alias permanent add it to either your `$CMDER_ROOT/config/user-profile.sh` or your `$HOME/.bashrc`.
|
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.
|
||||||
|
|
||||||
|
* '$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.exe Aliases
|
||||||
PowerShell has native simple alias support, for example `[new-alias | set-alias] alias command`, so complex aliases with optional parameters are not supported in PowerShell sessions. Type `get-help [new-alias|set-alias] -full` for help on PowerShell aliases.
|
PowerShell has native simple alias support, for example `[new-alias | set-alias] alias command`, so complex aliases with optional parameters are not supported in PowerShell sessions. Type `get-help [new-alias|set-alias] -full` for help on PowerShell aliases.
|
||||||
|
|
||||||
|
To make an alias and/or any other profile settings permanent add it to one of the following:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
* '$ENV:CMDER_ROOT\\config\\profile.d\\\*.ps1'
|
||||||
|
* '$ENV:CMDER_ROOT\\config\\user-profile.ps1'
|
||||||
|
|
||||||
### SSH Agent
|
### SSH Agent
|
||||||
|
|
||||||
To start SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-for-windows/cmd` folder.
|
To start SSH agent simply call `start-ssh-agent`, which is in the `vendor/git-for-windows/cmd` folder.
|
||||||
@ -131,7 +157,7 @@ If you want to run SSH agent on startup, include the line `@call "%GIT_INSTALL_R
|
|||||||
1. Click the '+' button to add a task.
|
1. Click the '+' button to add a task.
|
||||||
1. Name the new task in the top text box.
|
1. Name the new task in the top text box.
|
||||||
1. Provide task parameters, this is optional.
|
1. Provide task parameters, this is optional.
|
||||||
1. Add ```cmd /c "[path_to_external_env]\bin\bash --login -i" -new_console:d:%USERPROFILE%``` 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:
|
||||||
|
|
||||||
@ -150,11 +176,39 @@ 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.
|
# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Current development branch
|
## Upgrading
|
||||||
|
|
||||||
|
The process of upgrading Cmder depends on the version/build you are currently running
|
||||||
|
|
||||||
|
If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer version of Cmder, follow the below process:
|
||||||
|
|
||||||
|
1. Exit all Cmder sessions and relaunch `[cmder_root]/cmder.exe`, this backs up your existing `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`.
|
||||||
|
|
||||||
|
* The `[cmder_root]/config/user-conemu.xml` contains any custom settings you have made using the 'Setup Tasks' settings dialog.
|
||||||
|
|
||||||
|
2. Exit all Cmder sessions and backup any files you have manually edited under `[cmder_root]/vendor`.
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
If you do not have a `[cmder_root]/config/user-conemu.xml`, you are running an older version of cmder, follow the below process:
|
||||||
|
|
||||||
|
1. Exit all Cmder sessions and backup `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Current development builds
|
||||||
|
|
||||||
You can download builds of the current development branch by going to AppVeyor via the following link:
|
You can download builds of the current development branch by going to AppVeyor via the following link:
|
||||||
|
|
||||||
[](https://ci.appveyor.com/project/MartiUK/cmder/branch/development/artifacts)
|
[](https://ci.appveyor.com/project/MartiUK/cmder/branch/master/artifacts)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ branches:
|
|||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
|
|
||||||
# Operating system (build VM template)
|
# Operating system (build VM template)
|
||||||
os: Windows Server 2012 R2
|
os: Visual Studio 2017
|
||||||
|
|
||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
# build configuration #
|
# build configuration #
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
if "%aliases%" == "" (
|
if "%ALIASES%" == "" (
|
||||||
set ALIASES=%CMDER_ROOT%\config\user-aliases.cmd
|
set ALIASES="%CMDER_ROOT%\config\user-aliases.cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
@ -21,7 +21,7 @@ goto parseargument
|
|||||||
set currentarg=%~1
|
set currentarg=%~1
|
||||||
|
|
||||||
if /i "%currentarg%" equ "/f" (
|
if /i "%currentarg%" equ "/f" (
|
||||||
set aliases=%~2
|
set ALIASES=%~2
|
||||||
shift
|
shift
|
||||||
goto :do_shift
|
goto :do_shift
|
||||||
) else if /i "%currentarg%" == "/reload" (
|
) else if /i "%currentarg%" == "/reload" (
|
||||||
@ -50,21 +50,21 @@ goto parseargument
|
|||||||
)
|
)
|
||||||
rem #endregion parseargument
|
rem #endregion parseargument
|
||||||
|
|
||||||
if "%aliases%" neq "%CMDER_ROOT%\config\user-aliases.cmd" (
|
if "%ALIASES%" neq "%CMDER_ROOT%\config\user-aliases.cmd" (
|
||||||
set _x=!_x:/f %aliases% =!
|
set _x=!_x:/f "%ALIASES%" =!
|
||||||
|
|
||||||
if not exist "%aliases%" (
|
if not exist "%ALIASES%" (
|
||||||
echo ;= @echo off>"%aliases%"
|
echo ;= @echo off>"%ALIASES%"
|
||||||
echo ;= rem Call DOSKEY and use this file as the macrofile>>"%aliases%"
|
echo ;= rem Call DOSKEY and use this file as the macrofile>>"%ALIASES%"
|
||||||
echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%aliases%"
|
echo ;= %%SystemRoot%%\system32\doskey /listsize=1000 /macrofile=%%0%%>>"%ALIASES%"
|
||||||
echo ;= rem In batch mode, jump to the end of the file>>"%aliases%"
|
echo ;= rem In batch mode, jump to the end of the file>>"%ALIASES%"
|
||||||
echo ;= goto:eof>>"%aliases%"
|
echo ;= goto:eof>>"%ALIASES%"
|
||||||
echo ;= Add aliases below here>>"%aliases%"
|
echo ;= Add aliases below here>>"%ALIASES%"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:: validate alias
|
:: validate alias
|
||||||
for /f "delims== tokens=1,2 usebackq" %%G in (`echo "%_x%"`) do (
|
for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do (
|
||||||
set alias_name=%%G
|
set alias_name=%%G
|
||||||
set alias_value=%%H
|
set alias_value=%%H
|
||||||
)
|
)
|
||||||
@ -96,7 +96,7 @@ set del_alias=%~1
|
|||||||
findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||||
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
||||||
doskey %del_alias%=
|
doskey %del_alias%=
|
||||||
doskey /macrofile=%ALIASES%
|
doskey /macrofile="%ALIASES%"
|
||||||
goto:eof
|
goto:eof
|
||||||
|
|
||||||
:p_reload
|
:p_reload
|
||||||
@ -110,11 +110,11 @@ exit /b
|
|||||||
|
|
||||||
:p_help
|
:p_help
|
||||||
echo.Usage:
|
echo.Usage:
|
||||||
echo.
|
echo.
|
||||||
echo. alias [options] [alias=full command]
|
echo. alias [options] [alias=full command]
|
||||||
echo.
|
echo.
|
||||||
echo.Options:
|
echo.Options:
|
||||||
echo.
|
echo.
|
||||||
echo. /d [alias] Delete an [alias].
|
echo. /d [alias] Delete an [alias].
|
||||||
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
|
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
|
||||||
echo. Default: %cmder_root%\config\user-aliases.cmd
|
echo. Default: %cmder_root%\config\user-aliases.cmd
|
||||||
|
@ -153,7 +153,7 @@
|
|||||||
<value name="ComSpec.UpdateEnv" type="hex" data="00"/>
|
<value name="ComSpec.UpdateEnv" type="hex" data="00"/>
|
||||||
<value name="ComSpec.EnvAddPath" type="hex" data="01"/>
|
<value name="ComSpec.EnvAddPath" type="hex" data="01"/>
|
||||||
<value name="ComSpec.EnvAddExePath" type="hex" data="01"/>
|
<value name="ComSpec.EnvAddExePath" type="hex" data="01"/>
|
||||||
<value name="ComSpec.UncPaths" type="hex" data="00"/>
|
<value name="ComSpec.UncPaths" type="hex" data="01"/>
|
||||||
<value name="ComSpec.Path" type="string" data=""/>
|
<value name="ComSpec.Path" type="string" data=""/>
|
||||||
<value name="ConsoleTextSelection" type="hex" data="01"/>
|
<value name="ConsoleTextSelection" type="hex" data="01"/>
|
||||||
<value name="CTS.AutoCopy" type="hex" data="01"/>
|
<value name="CTS.AutoCopy" type="hex" data="01"/>
|
||||||
@ -488,7 +488,7 @@
|
|||||||
<key name="Task1" modified="2015-11-24 14:49:10" build="151119">
|
<key name="Task1" modified="2015-11-24 14:49:10" build="151119">
|
||||||
<value name="Name" type="string" data="{cmd::Cmder as Admin}"/>
|
<value name="Name" type="string" data="{cmd::Cmder as Admin}"/>
|
||||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
||||||
<value name="Cmd1" type="string" data="*cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:%USERPROFILE%"/>
|
<value name="Cmd1" type="string" data="*cmd /k "%ConEmuDir%\..\init.bat""/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
@ -497,7 +497,7 @@
|
|||||||
<key name="Task2" modified="2015-11-24 14:49:10" build="151119">
|
<key name="Task2" modified="2015-11-24 14:49:10" build="151119">
|
||||||
<value name="Name" type="string" data="{cmd::Cmder}"/>
|
<value name="Name" type="string" data="{cmd::Cmder}"/>
|
||||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
||||||
<value name="Cmd1" type="string" data="cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:%USERPROFILE%"/>
|
<value name="Cmd1" type="string" data="cmd /k "%ConEmuDir%\..\init.bat""/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
@ -507,7 +507,7 @@
|
|||||||
<value name="Name" type="string" data="{Powershell::PowerShell as Admin}"/>
|
<value name="Name" type="string" data="{Powershell::PowerShell as Admin}"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
||||||
<value name="Cmd1" type="string" data="*PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''" -new_console:d:"%USERPROFILE%""/>
|
<value name="Cmd1" type="string" data="*PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''""/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
<value name="Flags" type="dword" data="00000000"/>
|
<value name="Flags" type="dword" data="00000000"/>
|
||||||
@ -516,7 +516,7 @@
|
|||||||
<value name="Name" type="string" data="{Powershell::Powershell}"/>
|
<value name="Name" type="string" data="{Powershell::Powershell}"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
||||||
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''" -new_console:d:"%USERPROFILE%""/>
|
<value name="Cmd1" type="string" data="PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''""/>
|
||||||
<value name="Cmd2" type="string" data="%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe"/>
|
<value name="Cmd2" type="string" data="%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe"/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
@ -527,7 +527,7 @@
|
|||||||
<value name="Flags" type="dword" data="00000000"/>
|
<value name="Flags" type="dword" data="00000000"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
<value name="GuiArgs" type="string" data="/icon "%ConEmuDir%\..\git-for-windows\usr\share\git\git-for-windows.ico""/>
|
<value name="GuiArgs" type="string" data="/icon "%ConEmuDir%\..\git-for-windows\usr\share\git\git-for-windows.ico""/>
|
||||||
<value name="Cmd1" type="string" data="*%ConEmuDir%\..\git-for-windows\usr\bin\mintty.exe /bin/bash -l -new_console:d:%USERPROFILE%"/>
|
<value name="Cmd1" type="string" data="*%ConEmuDir%\..\git-for-windows\usr\bin\mintty.exe /bin/bash -l"/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
</key>
|
</key>
|
||||||
@ -536,10 +536,10 @@
|
|||||||
<value name="Flags" type="dword" data="00000000"/>
|
<value name="Flags" type="dword" data="00000000"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
<value name="GuiArgs" type="string" data="/icon "%ConEmuDir%\..\git-for-windows\usr\share\git\git-for-windows.ico""/>
|
<value name="GuiArgs" type="string" data="/icon "%ConEmuDir%\..\git-for-windows\usr\share\git\git-for-windows.ico""/>
|
||||||
<value name="Cmd1" type="string" data="%ConEmuDir%\..\git-for-windows\usr\bin\mintty.exe /bin/bash -l -new_console:d:%userProfile%"/>
|
<value name="Cmd1" type="string" data="%ConEmuDir%\..\git-for-windows\usr\bin\mintty.exe /bin/bash -l"/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
<value name="Cmd2" type="string" data="%CMDER_ROOT%vendor\git-for-windows\usr\bin\mintty.exe /bin/bash -l -new_console:d:%userProfile%"/>
|
<value name="Cmd2" type="string" data="%CMDER_ROOT%vendor\git-for-windows\usr\bin\mintty.exe /bin/bash -l"/>
|
||||||
</key>
|
</key>
|
||||||
<key name="Task7" modified="2015-11-24 14:49:10" build="151119">
|
<key name="Task7" modified="2015-11-24 14:49:10" build="151119">
|
||||||
<value name="Name" type="string" data="{bash::bash as Admin}"/>
|
<value name="Name" type="string" data="{bash::bash as Admin}"/>
|
||||||
@ -548,14 +548,14 @@
|
|||||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
<value name="Cmd1" type="string" data="*cmd /c "%ConEmuDir%\..\git-for-windows\bin\bash --login -i" -new_console:d:%USERPROFILE%"/>
|
<value name="Cmd1" type="string" data="*cmd /c "%ConEmuDir%\..\git-for-windows\bin\bash --login -i""/>
|
||||||
</key>
|
</key>
|
||||||
<key name="Task8" modified="2015-11-24 14:49:10" build="151119">
|
<key name="Task8" modified="2015-11-24 14:49:10" build="151119">
|
||||||
<value name="Name" type="string" data="{bash::bash}"/>
|
<value name="Name" type="string" data="{bash::bash}"/>
|
||||||
<value name="Flags" type="dword" data="00000000"/>
|
<value name="Flags" type="dword" data="00000000"/>
|
||||||
<value name="Hotkey" type="dword" data="00000000"/>
|
<value name="Hotkey" type="dword" data="00000000"/>
|
||||||
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
<value name="GuiArgs" type="string" data=" /icon "%CMDER_ROOT%\icons\cmder.ico""/>
|
||||||
<value name="Cmd1" type="string" data="cmd /c "%ConEmuDir%\..\git-for-windows\bin\bash --login -i" -new_console:d:%USERPROFILE%"/>
|
<value name="Cmd1" type="string" data="cmd /c "%ConEmuDir%\..\git-for-windows\bin\bash --login -i""/>
|
||||||
<value name="Active" type="dword" data="00000000"/>
|
<value name="Active" type="dword" data="00000000"/>
|
||||||
<value name="Count" type="dword" data="00000001"/>
|
<value name="Count" type="dword" data="00000001"/>
|
||||||
</key>
|
</key>
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
All config files must be in this folder. If there is no option to set this folder
|
All config files must be in this folder. If there is no option to set this folder
|
||||||
directly, it has to be hardlinked.
|
directly, it has to be hardlinked.
|
||||||
|
|
||||||
* `aliases`: aliases in cmd; called form vendor\init.bat; autocreated from
|
* `user-aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from
|
||||||
`vendor\aliases.example`.
|
`vendor\user-aliases.cmd.example`.
|
||||||
* `*.lua`: clink completions and prompt filters; called from vendor\cmder.lua after all
|
* `*.lua`: clink completions and prompt filters; autoloaded after all
|
||||||
other prompt filter and clink completions are initialized; add your own.
|
prompt filter and clink completions are initialized; add your own.
|
||||||
* `user_profile.{sh|bat|ps1}`: startup files for bash|cmd|powershell tasks; called from their
|
* `user-profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their
|
||||||
respective startup scripts in `vendor\`; autocreated on first start of such a task
|
respective startup scripts in `vendor\`; autocreated on first start of such a task.
|
||||||
* `.history`: the current commandline history; autoupdated on close
|
* `.history`: the current commandline history; autoupdated on close.
|
||||||
* `settings`: settings for readline; overwritten on update
|
* `settings`: settings for readline; overwritten on update.
|
||||||
* `ConEmu.xml`: settings from ConEmu (=the UI of cmder -> Preferences); overwritten on update
|
* `ConEmu.xml`: settings from ConEmu (=the UI of cmder -> Preferences); overwritten on update.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
@ -19,13 +19,13 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v140_xp</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v140_xp</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
#pragma comment(lib, "Shlwapi.lib")
|
#pragma comment(lib, "Shlwapi.lib")
|
||||||
|
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
@ -31,7 +30,7 @@ void ShowErrorAndExit(DWORD ec, const wchar_t * func, int line)
|
|||||||
{
|
{
|
||||||
wchar_t * buffer;
|
wchar_t * buffer;
|
||||||
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL, ec, 0, (LPWSTR) &buffer, 0, NULL) == 0)
|
NULL, ec, 0, (LPWSTR)&buffer, 0, NULL) == 0)
|
||||||
{
|
{
|
||||||
buffer = L"Unknown error. FormatMessage failed.";
|
buffer = L"Unknown error. FormatMessage failed.";
|
||||||
}
|
}
|
||||||
@ -54,7 +53,6 @@ typedef struct _option
|
|||||||
|
|
||||||
typedef std::pair<std::wstring, std::wstring> optpair;
|
typedef std::pair<std::wstring, std::wstring> optpair;
|
||||||
|
|
||||||
|
|
||||||
optpair GetOption()
|
optpair GetOption()
|
||||||
{
|
{
|
||||||
wchar_t * cmd = GetCommandLine();
|
wchar_t * cmd = GetCommandLine();
|
||||||
@ -95,7 +93,7 @@ bool FileExists(const wchar_t * filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartCmder(std::wstring path, bool is_single_mode)
|
void StartCmder(std::wstring path, bool is_single_mode, std::wstring taskName = L"")
|
||||||
{
|
{
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
wchar_t appId[MAX_PATH] = { 0 };
|
wchar_t appId[MAX_PATH] = { 0 };
|
||||||
@ -125,13 +123,13 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
|
ExpandEnvironmentStrings(cpuCfgPath, cpuCfgPath, sizeof(cpuCfgPath) / sizeof(cpuCfgPath[0]));
|
||||||
|
|
||||||
PathCombine(userCfgPath, exeDir, L"config\\user-ConEmu.xml");
|
PathCombine(userCfgPath, exeDir, L"config\\user-ConEmu.xml");
|
||||||
|
|
||||||
if (PathFileExists(cpuCfgPath)) {
|
if (PathFileExists(cpuCfgPath)) {
|
||||||
wcsncpy_s(oldCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
wcsncpy_s(oldCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
||||||
wcsncpy_s(backupCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
wcsncpy_s(backupCfgPath, cpuCfgPath, sizeof(cpuCfgPath));
|
||||||
}
|
}
|
||||||
else if (PathFileExists(userCfgPath)) {
|
else if (PathFileExists(userCfgPath)) {
|
||||||
wcsncpy_s(oldCfgPath, userCfgPath,sizeof(userCfgPath));
|
wcsncpy_s(oldCfgPath, userCfgPath, sizeof(userCfgPath));
|
||||||
wcsncpy_s(backupCfgPath, userCfgPath, sizeof(userCfgPath));
|
wcsncpy_s(backupCfgPath, userCfgPath, sizeof(userCfgPath));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -157,7 +155,7 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
{
|
{
|
||||||
MessageBox(NULL,
|
MessageBox(NULL,
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
? L"Failed to copy ConEmu.xml file to new location! Restart cmder as administrator."
|
? L"Failed to copy ConEmu.xml file to new location! Restart Cmder as administrator."
|
||||||
: L"Failed to copy ConEmu.xml file to new location!", MB_TITLE, MB_ICONSTOP);
|
: L"Failed to copy ConEmu.xml file to new location!", MB_TITLE, MB_ICONSTOP);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -171,24 +169,29 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (streqi(path.c_str(), L""))
|
||||||
|
{
|
||||||
|
TCHAR buff[MAX_PATH];
|
||||||
|
const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", buff, MAX_PATH);
|
||||||
|
path = buff;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_single_mode)
|
if (is_single_mode)
|
||||||
{
|
{
|
||||||
swprintf_s(args, L"/single /Icon \"%s\" /Title Cmder", icoPath);
|
swprintf_s(args, L"/single /Icon \"%s\" /Title Cmder /dir \"%s\"", icoPath, path.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf_s(args, L"/Icon \"%s\" /Title Cmder", icoPath);
|
swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\"", icoPath, path.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!taskName.empty()) {
|
||||||
|
swprintf_s(args, L"%s /run {%s}", args, taskName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
||||||
if (!streqi(path.c_str(), L""))
|
|
||||||
{
|
|
||||||
if (!SetEnvironmentVariable(L"CMDER_START", path.c_str())) {
|
|
||||||
MessageBox(NULL, _T("Error trying to set CMDER_START to given path!"), _T("Error"), MB_OK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Ensure EnvironmentVariables are propagated.
|
|
||||||
|
|
||||||
|
// Ensure EnvironmentVariables are propagated.
|
||||||
|
|
||||||
STARTUPINFO si = { 0 };
|
STARTUPINFO si = { 0 };
|
||||||
si.cb = sizeof(STARTUPINFO);
|
si.cb = sizeof(STARTUPINFO);
|
||||||
@ -198,13 +201,12 @@ void StartCmder(std::wstring path, bool is_single_mode)
|
|||||||
#endif
|
#endif
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
if (!CreateProcess(conEmuPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) {
|
if (!CreateProcess(conEmuPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) {
|
||||||
MessageBox(NULL, _T("Unable to create the ConEmu Process!"), _T("Error"), MB_OK);
|
MessageBox(NULL, _T("Unable to create the ConEmu process!"), _T("Error"), MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL);
|
LRESULT lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL);
|
||||||
lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) L"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL); // For Windows >= 8
|
lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL); // For Windows >= 8
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsUserOnly(std::wstring opt)
|
bool IsUserOnly(std::wstring opt)
|
||||||
@ -234,8 +236,7 @@ HKEY GetRootKey(std::wstring opt)
|
|||||||
|
|
||||||
if (IsUserOnly(opt))
|
if (IsUserOnly(opt))
|
||||||
{
|
{
|
||||||
FAIL_ON_ERROR(RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Classes", 0, NULL,
|
FAIL_ON_ERROR(RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Classes", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &root, NULL));
|
||||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &root, NULL));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,9 +268,7 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
|||||||
HKEY root = GetRootKey(opt);
|
HKEY root = GetRootKey(opt);
|
||||||
|
|
||||||
HKEY cmderKey;
|
HKEY cmderKey;
|
||||||
FAIL_ON_ERROR(
|
FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
||||||
RegCreateKeyEx(root, keyBaseName, 0, NULL,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
|
||||||
|
|
||||||
FAIL_ON_ERROR(RegSetValue(cmderKey, L"", REG_SZ, L"Cmder Here", NULL));
|
FAIL_ON_ERROR(RegSetValue(cmderKey, L"", REG_SZ, L"Cmder Here", NULL));
|
||||||
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"NoWorkingDirectory", 0, REG_SZ, (BYTE *)L"", 2));
|
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"NoWorkingDirectory", 0, REG_SZ, (BYTE *)L"", 2));
|
||||||
@ -277,9 +276,7 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
|||||||
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"Icon", 0, REG_SZ, (BYTE *)icoPath, wcslen(icoPath) * sizeof(wchar_t)));
|
FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"Icon", 0, REG_SZ, (BYTE *)icoPath, wcslen(icoPath) * sizeof(wchar_t)));
|
||||||
|
|
||||||
HKEY command;
|
HKEY command;
|
||||||
FAIL_ON_ERROR(
|
FAIL_ON_ERROR(RegCreateKeyEx(cmderKey, L"command", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &command, NULL));
|
||||||
RegCreateKeyEx(cmderKey, L"command", 0, NULL,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &command, NULL));
|
|
||||||
|
|
||||||
FAIL_ON_ERROR(RegSetValue(command, L"", REG_SZ, commandStr, NULL));
|
FAIL_ON_ERROR(RegSetValue(command, L"", REG_SZ, commandStr, NULL));
|
||||||
|
|
||||||
@ -292,9 +289,7 @@ void UnregisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
|||||||
{
|
{
|
||||||
HKEY root = GetRootKey(opt);
|
HKEY root = GetRootKey(opt);
|
||||||
HKEY cmderKey;
|
HKEY cmderKey;
|
||||||
FAIL_ON_ERROR(
|
FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
||||||
RegCreateKeyEx(root, keyBaseName, 0, NULL,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
|
|
||||||
#if XP
|
#if XP
|
||||||
FAIL_ON_ERROR(SHDeleteKey(cmderKey, NULL));
|
FAIL_ON_ERROR(SHDeleteKey(cmderKey, NULL));
|
||||||
#else
|
#else
|
||||||
@ -323,6 +318,10 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
{
|
{
|
||||||
StartCmder(opt.second, true);
|
StartCmder(opt.second, true);
|
||||||
}
|
}
|
||||||
|
else if (streqi(opt.first.c_str(), L"/TASK"))
|
||||||
|
{
|
||||||
|
StartCmder(L"", false, opt.second);
|
||||||
|
}
|
||||||
else if (streqi(opt.first.c_str(), L"/REGISTER"))
|
else if (streqi(opt.first.c_str(), L"/REGISTER"))
|
||||||
{
|
{
|
||||||
RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
||||||
@ -335,7 +334,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START <path>\n /SINGLE <path>\n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK);
|
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START <path>\n /SINGLE <path>\n /TASK <name>\n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -19,3 +19,4 @@ appveyor.yml
|
|||||||
vendor\cmder.sh
|
vendor\cmder.sh
|
||||||
vendor\git-prompt.sh
|
vendor\git-prompt.sh
|
||||||
config\user-*
|
config\user-*
|
||||||
|
.github_changelog_generator
|
@ -53,6 +53,6 @@ $version = Invoke-Expression "git describe --abbrev=0 --tags"
|
|||||||
|
|
||||||
foreach ($t in $targets.GetEnumerator()) {
|
foreach ($t in $targets.GetEnumerator()) {
|
||||||
Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value
|
Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value
|
||||||
$hash = (Digest-MD5 "$saveTo\$($t.Name)")
|
$hash = (Digest-Hash "$saveTo\$($t.Name)")
|
||||||
Add-Content "$saveTo\hashes.txt" $hash
|
Add-Content -path "$saveTo\hashes.txt" -value ($t.Name + ' ' + $hash)
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
function Ensure-Exists ($path) {
|
function Ensure-Exists($path) {
|
||||||
if (-not (Test-Path $path)) {
|
if (-not (Test-Path $path)) {
|
||||||
Write-Error "Missing required $path! Ensure it is installed"
|
Write-Error "Missing required $path! Ensure it is installed"
|
||||||
exit 1
|
exit 1
|
||||||
@ -6,7 +6,7 @@ function Ensure-Exists ($path) {
|
|||||||
return $true > $null
|
return $true > $null
|
||||||
}
|
}
|
||||||
|
|
||||||
function Ensure-Executable ($command) {
|
function Ensure-Executable($command) {
|
||||||
try { Get-Command $command -ErrorAction Stop > $null }
|
try { Get-Command $command -ErrorAction Stop > $null }
|
||||||
catch {
|
catch {
|
||||||
If( ($command -eq "7z") -and (Test-Path "$env:programfiles\7-zip\7z.exe") ){
|
If( ($command -eq "7z") -and (Test-Path "$env:programfiles\7-zip\7z.exe") ){
|
||||||
@ -22,12 +22,12 @@ function Ensure-Executable ($command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Delete-Existing ($path) {
|
function Delete-Existing($path) {
|
||||||
Write-Verbose "Remove $path"
|
Write-Verbose "Remove $path"
|
||||||
Remove-Item -Recurse -force $path -ErrorAction SilentlyContinue
|
Remove-Item -Recurse -force $path -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
function Extract-Archive ($source, $target) {
|
function Extract-Archive($source, $target) {
|
||||||
Write-Verbose $("Extracting Archive '$cmder_root\vendor\" + $source.replace('/','\') + " to '$cmder_root\vendor\$target'")
|
Write-Verbose $("Extracting Archive '$cmder_root\vendor\" + $source.replace('/','\') + " to '$cmder_root\vendor\$target'")
|
||||||
Invoke-Expression "7z x -y -o`"$($target)`" `"$source`" > `$null"
|
Invoke-Expression "7z x -y -o`"$($target)`" `"$source`" > `$null"
|
||||||
if ($lastexitcode -ne 0) {
|
if ($lastexitcode -ne 0) {
|
||||||
@ -36,7 +36,7 @@ function Extract-Archive ($source, $target) {
|
|||||||
Remove-Item $source
|
Remove-Item $source
|
||||||
}
|
}
|
||||||
|
|
||||||
function Create-Archive ($source, $target, $params) {
|
function Create-Archive($source, $target, $params) {
|
||||||
$command = "7z a -x@`"$source\packignore`" $params $target $source > `$null"
|
$command = "7z a -x@`"$source\packignore`" $params $target $source > `$null"
|
||||||
Write-Verbose "Running: $command"
|
Write-Verbose "Running: $command"
|
||||||
Invoke-Expression $command
|
Invoke-Expression $command
|
||||||
@ -47,22 +47,22 @@ function Create-Archive ($source, $target, $params) {
|
|||||||
|
|
||||||
# If directory contains only one child directory
|
# If directory contains only one child directory
|
||||||
# Flatten it instead
|
# Flatten it instead
|
||||||
function Flatten-Directory ($name) {
|
function Flatten-Directory($name) {
|
||||||
$child = (Get-Childitem $name)[0]
|
$child = (Get-Childitem $name)[0]
|
||||||
Rename-Item $name -NewName "$($name)_moving"
|
Rename-Item $name -NewName "$($name)_moving"
|
||||||
Move-Item -Path "$($name)_moving\$child" -Destination $name
|
Move-Item -Path "$($name)_moving\$child" -Destination $name
|
||||||
Remove-Item -Recurse "$($name)_moving"
|
Remove-Item -Recurse "$($name)_moving"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Digest-MD5 ($path) {
|
function Digest-Hash($path) {
|
||||||
if(Get-Command Get-FileHash -ErrorAction SilentlyContinue){
|
if(Get-Command Get-FileHash -ErrorAction SilentlyContinue){
|
||||||
return (Get-FileHash -Algorithm MD5 -Path $path).Hash
|
return (Get-FileHash -Algorithm SHA256 -Path $path).Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
return Invoke-Expression "md5sum $path"
|
return Invoke-Expression "md5sum $path"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Register-Cmder(){
|
function Register-Cmder() {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
Param
|
Param
|
||||||
(
|
(
|
||||||
@ -76,7 +76,7 @@ function Register-Cmder(){
|
|||||||
$Command = "%V"
|
$Command = "%V"
|
||||||
|
|
||||||
, # Defaults to the icons folder in the cmder package.
|
, # Defaults to the icons folder in the cmder package.
|
||||||
$icon = (Split-Path $PathToExe | join-path -ChildPath 'icons/cmder.ico')
|
$icon = (Split-Path $PathToExe | Join-Path -ChildPath 'icons/cmder.ico')
|
||||||
)
|
)
|
||||||
Begin
|
Begin
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ function Register-Cmder(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Unregister-Cmder{
|
function Unregister-Cmder {
|
||||||
Begin
|
Begin
|
||||||
{
|
{
|
||||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT > $null
|
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT > $null
|
||||||
@ -124,9 +124,9 @@ function Download-File {
|
|||||||
# I think this is the problem
|
# I think this is the problem
|
||||||
$File = $File -Replace "/", "\"
|
$File = $File -Replace "/", "\"
|
||||||
Write-Verbose "Downloading from $Url to $File"
|
Write-Verbose "Downloading from $Url to $File"
|
||||||
$wc = new-object System.Net.WebClient
|
$wc = New-Object System.Net.WebClient
|
||||||
if ($env:https_proxy) {
|
if ($env:https_proxy) {
|
||||||
$wc.proxy = (new-object System.Net.WebProxy($env:https_proxy))
|
$wc.proxy = (New-Object System.Net.WebProxy($env:https_proxy))
|
||||||
}
|
}
|
||||||
$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
|
$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
|
||||||
$wc.DownloadFile($Url, $File)
|
$wc.DownloadFile($Url, $File)
|
||||||
|
235
vendor/clink.lua
vendored
235
vendor/clink.lua
vendored
@ -3,9 +3,10 @@
|
|||||||
-- !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
-- !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
||||||
-- !!! Use "%CMDER_ROOT%\config\<whatever>.lua" to add your lua startup scripts
|
-- !!! Use "%CMDER_ROOT%\config\<whatever>.lua" to add your lua startup scripts
|
||||||
|
|
||||||
|
-- luacheck: globals clink
|
||||||
|
|
||||||
-- At first, load the original clink.lua file
|
-- At first, load the original clink.lua file
|
||||||
-- this is needed as we set the script path to this dir and therefore the original
|
-- this is needed as we set the script path to this dir and therefore the original
|
||||||
-- clink.lua is not loaded.
|
-- clink.lua is not loaded.
|
||||||
local clink_lua_file = clink.get_env('CMDER_ROOT')..'\\vendor\\clink\\clink.lua'
|
local clink_lua_file = clink.get_env('CMDER_ROOT')..'\\vendor\\clink\\clink.lua'
|
||||||
dofile(clink_lua_file)
|
dofile(clink_lua_file)
|
||||||
@ -13,11 +14,11 @@ dofile(clink_lua_file)
|
|||||||
-- now add our own things...
|
-- now add our own things...
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Setting the prompt in clink means that commands which rewrite the prompt do
|
-- 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
|
-- not destroy our own prompt. It also means that started cmds (or batch files
|
||||||
-- which echo) don't get the ugly '{lamb}' shown.
|
-- which echo) don't get the ugly '{lamb}' shown.
|
||||||
---
|
---
|
||||||
function set_prompt_filter()
|
local function set_prompt_filter()
|
||||||
-- get_cwd() is differently encoded than the clink.prompt.value, so everything other than
|
-- get_cwd() is differently encoded than the clink.prompt.value, so everything other than
|
||||||
-- pure ASCII will get garbled. So try to parse the current directory from the original prompt
|
-- pure ASCII will get garbled. So try to parse the current directory from the original prompt
|
||||||
-- and only if that doesn't work, use get_cwd() directly.
|
-- and only if that doesn't work, use get_cwd() directly.
|
||||||
@ -26,7 +27,7 @@ function set_prompt_filter()
|
|||||||
local old_prompt = clink.prompt.value
|
local old_prompt = clink.prompt.value
|
||||||
local cwd = old_prompt:match('.*(.:[^>]*)>')
|
local cwd = old_prompt:match('.*(.:[^>]*)>')
|
||||||
if cwd == nil then cwd = clink.get_cwd() end
|
if cwd == nil then cwd = clink.get_cwd() end
|
||||||
|
|
||||||
-- environment systems like pythons virtualenv change the PROMPT and usually
|
-- environment systems like pythons virtualenv change the PROMPT and usually
|
||||||
-- set some variable. But the variables are differently named and we would never
|
-- set some variable. But the variables are differently named and we would never
|
||||||
-- get them all, so try to parse the env name out of the PROMPT.
|
-- get them all, so try to parse the env name out of the PROMPT.
|
||||||
@ -34,11 +35,12 @@ function set_prompt_filter()
|
|||||||
local env = old_prompt:match('.*%(([^%)]+)%).+:')
|
local env = old_prompt:match('.*%(([^%)]+)%).+:')
|
||||||
-- also check for square brackets
|
-- also check for square brackets
|
||||||
if env == nil then env = old_prompt:match('.*%[([^%]]+)%].+:') end
|
if env == nil then env = old_prompt:match('.*%[([^%]]+)%].+:') end
|
||||||
|
|
||||||
-- build our own prompt
|
-- build our own prompt
|
||||||
-- orig: $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m
|
-- orig: $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m
|
||||||
-- color codes: "\x1b[1;37;40m"
|
-- color codes: "\x1b[1;37;40m"
|
||||||
local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg} \n\x1b[1;30;40m{lamb} \x1b[0m"
|
local cmder_prompt = "\x1b[1;32;40m{cwd} {git}{hg}{svn} \n\x1b[1;39;40m{lamb} \x1b[0m"
|
||||||
|
local lambda
|
||||||
cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd)
|
cmder_prompt = string.gsub(cmder_prompt, "{cwd}", cwd)
|
||||||
if env == nil then
|
if env == nil then
|
||||||
lambda = "λ"
|
lambda = "λ"
|
||||||
@ -49,12 +51,12 @@ function set_prompt_filter()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Resolves closest directory location for specified directory.
|
-- Resolves closest directory location for specified directory.
|
||||||
-- Navigates subsequently up one level and tries to find specified directory
|
-- Navigates subsequently up one level and tries to find specified directory
|
||||||
-- @param {string} path Path to directory will be checked. If not provided
|
-- @param {string} path Path to directory will be checked. If not provided
|
||||||
-- current directory will be used
|
-- current directory will be used
|
||||||
-- @param {string} dirname Directory name to search for
|
-- @param {string} dirname Directory name to search for
|
||||||
-- @return {string} Path to specified directory or nil if such dir not found
|
-- @return {string} Path to specified directory or nil if such dir not found
|
||||||
local function get_dir_contains(path, dirname)
|
local function get_dir_contains(path, dirname)
|
||||||
|
|
||||||
-- return parent path for specified entry (either file or directory)
|
-- return parent path for specified entry (either file or directory)
|
||||||
@ -99,10 +101,6 @@ local function get_dir_contains(path, dirname)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_hg_dir(path)
|
|
||||||
return get_dir_contains(path, '.hg')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- adapted from from clink-completions' git.lua
|
-- adapted from from clink-completions' git.lua
|
||||||
local function get_git_dir(path)
|
local function get_git_dir(path)
|
||||||
|
|
||||||
@ -113,12 +111,13 @@ local function get_git_dir(path)
|
|||||||
if i then
|
if i then
|
||||||
prefix = path:sub(1, i-1)
|
prefix = path:sub(1, i-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
return prefix
|
return prefix
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Checks if provided directory contains git directory
|
-- Checks if provided directory contains git directory
|
||||||
local function has_git_dir(dir)
|
local function has_git_dir(dir)
|
||||||
return #clink.find_dirs(dir..'/.git') > 0 and dir..'/.git'
|
return clink.is_dir(dir..'/.git') and dir..'/.git'
|
||||||
end
|
end
|
||||||
|
|
||||||
local function has_git_file(dir)
|
local function has_git_file(dir)
|
||||||
@ -144,67 +143,20 @@ local function get_git_dir(path)
|
|||||||
or (parent_path ~= path and get_git_dir(parent_path) or nil)
|
or (parent_path ~= path and get_git_dir(parent_path) or nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
local function get_hg_dir(path)
|
||||||
-- Find out current branch
|
return get_dir_contains(path, '.hg')
|
||||||
-- @return {false|mercurial branch name}
|
end
|
||||||
---
|
|
||||||
function get_hg_branch()
|
|
||||||
for line in io.popen("hg branch 2>nul"):lines() do
|
|
||||||
local m = line:match("(.+)$")
|
|
||||||
if m then
|
|
||||||
return m
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
local function get_svn_dir(path)
|
||||||
|
return get_dir_contains(path, '.svn')
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Get the status of working dir
|
-- Find out current branch
|
||||||
-- @return {bool}
|
-- @return {nil|git branch name}
|
||||||
---
|
---
|
||||||
function get_hg_status()
|
local function get_git_branch(git_dir)
|
||||||
for line in io.popen("hg status -0"):lines() do
|
git_dir = git_dir or get_git_dir()
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function hg_prompt_filter()
|
|
||||||
|
|
||||||
-- Colors for mercurial status
|
|
||||||
local colors = {
|
|
||||||
clean = "\x1b[1;37;40m",
|
|
||||||
dirty = "\x1b[31;1m",
|
|
||||||
}
|
|
||||||
|
|
||||||
if get_hg_dir() then
|
|
||||||
-- if we're inside of mercurial repo then try to detect current branch
|
|
||||||
local branch = get_hg_branch()
|
|
||||||
if branch then
|
|
||||||
-- Has branch => therefore it is a mercurial folder, now figure out status
|
|
||||||
if get_hg_status() then
|
|
||||||
color = colors.clean
|
|
||||||
else
|
|
||||||
color = colors.dirty
|
|
||||||
end
|
|
||||||
|
|
||||||
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", color.."("..branch..")")
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- No mercurial present or not in mercurial file
|
|
||||||
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", "")
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
---
|
|
||||||
-- Find out current branch
|
|
||||||
-- @return {nil|git branch name}
|
|
||||||
---
|
|
||||||
function get_git_branch(git_dir)
|
|
||||||
local git_dir = git_dir or get_git_dir()
|
|
||||||
|
|
||||||
-- If git directory not found then we're probably outside of repo
|
-- If git directory not found then we're probably outside of repo
|
||||||
-- or something went wrong. The same is when head_file is nil
|
-- or something went wrong. The same is when head_file is nil
|
||||||
@ -217,24 +169,86 @@ function get_git_branch(git_dir)
|
|||||||
-- if HEAD matches branch expression, then we're on named branch
|
-- if HEAD matches branch expression, then we're on named branch
|
||||||
-- otherwise it is a detached commit
|
-- otherwise it is a detached commit
|
||||||
local branch_name = HEAD:match('ref: refs/heads/(.+)')
|
local branch_name = HEAD:match('ref: refs/heads/(.+)')
|
||||||
|
|
||||||
return branch_name or 'HEAD detached at '..HEAD:sub(1, 7)
|
return branch_name or 'HEAD detached at '..HEAD:sub(1, 7)
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Get the status of working dir
|
-- Find out current branch
|
||||||
-- @return {bool}
|
-- @return {false|mercurial branch name}
|
||||||
---
|
---
|
||||||
function get_git_status()
|
local function get_hg_branch()
|
||||||
local file = io.popen("git status --no-lock-index --porcelain 2>nul")
|
for line in io.popen("hg branch 2>nul"):lines() do
|
||||||
|
local m = line:match("(.+)$")
|
||||||
|
if m then
|
||||||
|
return m
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Find out current branch
|
||||||
|
-- @return {false|svn branch name}
|
||||||
|
---
|
||||||
|
local function get_svn_branch(svn_dir)
|
||||||
|
for line in io.popen("svn info 2>nul"):lines() do
|
||||||
|
local m = line:match("^Relative URL:")
|
||||||
|
if m then
|
||||||
|
return line:sub(line:find("/")+1,line:len())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Get the status of working dir
|
||||||
|
-- @return {bool}
|
||||||
|
---
|
||||||
|
local function get_git_status()
|
||||||
|
local file = io.popen("git --no-optional-locks status --porcelain 2>nul")
|
||||||
for line in file:lines() do
|
for line in file:lines() do
|
||||||
file:close()
|
file:close()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function git_prompt_filter()
|
---
|
||||||
|
-- Get the status of working dir
|
||||||
|
-- @return {bool}
|
||||||
|
---
|
||||||
|
local function get_hg_status()
|
||||||
|
local file = io.popen("hg status -0")
|
||||||
|
for line in file:lines() do
|
||||||
|
file:close()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
file:close()
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Get the status of working dir
|
||||||
|
-- @return {bool}
|
||||||
|
---
|
||||||
|
function get_svn_status()
|
||||||
|
local file = io.popen("svn status -q")
|
||||||
|
for line in file:lines() do
|
||||||
|
file:close()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
file:close()
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function git_prompt_filter()
|
||||||
|
|
||||||
-- Colors for git status
|
-- Colors for git status
|
||||||
local colors = {
|
local colors = {
|
||||||
@ -246,6 +260,7 @@ function git_prompt_filter()
|
|||||||
if git_dir then
|
if git_dir then
|
||||||
-- if we're inside of git repo then try to detect current branch
|
-- if we're inside of git repo then try to detect current branch
|
||||||
local branch = get_git_branch(git_dir)
|
local branch = get_git_branch(git_dir)
|
||||||
|
local color
|
||||||
if branch then
|
if branch then
|
||||||
-- Has branch => therefore it is a git folder, now figure out status
|
-- Has branch => therefore it is a git folder, now figure out status
|
||||||
if get_git_status() then
|
if get_git_status() then
|
||||||
@ -264,10 +279,69 @@ function git_prompt_filter()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function hg_prompt_filter()
|
||||||
|
|
||||||
|
-- Colors for mercurial status
|
||||||
|
local colors = {
|
||||||
|
clean = "\x1b[1;37;40m",
|
||||||
|
dirty = "\x1b[31;1m",
|
||||||
|
}
|
||||||
|
|
||||||
|
if get_hg_dir() then
|
||||||
|
-- if we're inside of mercurial repo then try to detect current branch
|
||||||
|
local branch = get_hg_branch()
|
||||||
|
local color
|
||||||
|
if branch then
|
||||||
|
-- Has branch => therefore it is a mercurial folder, now figure out status
|
||||||
|
if get_hg_status() then
|
||||||
|
color = colors.clean
|
||||||
|
else
|
||||||
|
color = colors.dirty
|
||||||
|
end
|
||||||
|
|
||||||
|
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", color.."("..branch..")")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- No mercurial present or not in mercurial file
|
||||||
|
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", "")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function svn_prompt_filter()
|
||||||
|
-- Colors for svn status
|
||||||
|
local colors = {
|
||||||
|
clean = "\x1b[1;37;40m",
|
||||||
|
dirty = "\x1b[31;1m",
|
||||||
|
}
|
||||||
|
|
||||||
|
if get_svn_dir() then
|
||||||
|
-- if we're inside of svn repo then try to detect current branch
|
||||||
|
local branch = get_svn_branch()
|
||||||
|
local color
|
||||||
|
if branch then
|
||||||
|
if get_svn_status() then
|
||||||
|
color = colors.clean
|
||||||
|
else
|
||||||
|
color = colors.dirty
|
||||||
|
end
|
||||||
|
|
||||||
|
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..branch..")")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- No mercurial present or not in mercurial file
|
||||||
|
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", "")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- insert the set_prompt at the very beginning so that it runs first
|
-- insert the set_prompt at the very beginning so that it runs first
|
||||||
clink.prompt.register_filter(set_prompt_filter, 1)
|
clink.prompt.register_filter(set_prompt_filter, 1)
|
||||||
clink.prompt.register_filter(hg_prompt_filter, 50)
|
clink.prompt.register_filter(hg_prompt_filter, 50)
|
||||||
clink.prompt.register_filter(git_prompt_filter, 50)
|
clink.prompt.register_filter(git_prompt_filter, 50)
|
||||||
|
clink.prompt.register_filter(svn_prompt_filter, 50)
|
||||||
|
|
||||||
local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/'
|
local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/'
|
||||||
for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do
|
for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do
|
||||||
@ -279,4 +353,3 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do
|
|||||||
dofile(filename)
|
dofile(filename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
57
vendor/git-prompt.sh
vendored
57
vendor/git-prompt.sh
vendored
@ -1,22 +1,39 @@
|
|||||||
PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title
|
if test -f /etc/profile.d/git-sdk.sh
|
||||||
PS1="$PS1"'\[\033[32m\]' # change to green
|
|
||||||
PS1="$PS1"'\u@\h ' # user@host<space>
|
|
||||||
PS1="$PS1"'\[\033[33m\]' # change to brownish yellow
|
|
||||||
PS1="$PS1"'\w' # current working directory
|
|
||||||
if test -z "$WINELOADERNOEXEC"
|
|
||||||
then
|
then
|
||||||
GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
|
TITLEPREFIX=SDK-${MSYSTEM#MINGW}
|
||||||
COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
|
else
|
||||||
COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
|
TITLEPREFIX=$MSYSTEM
|
||||||
COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
|
|
||||||
if test -f "$COMPLETION_PATH/git-prompt.sh"
|
|
||||||
then
|
|
||||||
. "$COMPLETION_PATH/git-completion.bash"
|
|
||||||
. "$COMPLETION_PATH/git-prompt.sh"
|
|
||||||
PS1="$PS1"'\[\033[36m\]' # change color to cyan
|
|
||||||
PS1="$PS1"'`__git_ps1`' # bash function
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
PS1="$PS1"'\[\033[0m\]' # change color
|
|
||||||
PS1="$PS1"'\n' # new line
|
if test -f ~/.config/git/git-prompt.sh
|
||||||
PS1="$PS1"'λ ' # prompt: always λ
|
then
|
||||||
|
. ~/.config/git/git-prompt.sh
|
||||||
|
else
|
||||||
|
PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title
|
||||||
|
# PS1="$PS1"'\n' # new line
|
||||||
|
PS1="$PS1"'\[\033[32m\]' # change to green
|
||||||
|
PS1="$PS1"'\u@\h ' # user@host<space>
|
||||||
|
# PS1="$PS1"'\[\033[35m\]' # change to purple
|
||||||
|
# PS1="$PS1"'$MSYSTEM ' # show MSYSTEM
|
||||||
|
PS1="$PS1"'\[\033[33m\]' # change to brownish yellow
|
||||||
|
PS1="$PS1"'\w' # current working directory
|
||||||
|
if test -z "$WINELOADERNOEXEC"
|
||||||
|
then
|
||||||
|
GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
|
||||||
|
COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
|
||||||
|
COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
|
||||||
|
COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
|
||||||
|
if test -f "$COMPLETION_PATH/git-prompt.sh"
|
||||||
|
then
|
||||||
|
. "$COMPLETION_PATH/git-completion.bash"
|
||||||
|
. "$COMPLETION_PATH/git-prompt.sh"
|
||||||
|
PS1="$PS1"'\[\033[36m\]' # change color to cyan
|
||||||
|
PS1="$PS1"'`__git_ps1`' # bash function
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
PS1="$PS1"'\[\033[0m\]' # change color
|
||||||
|
PS1="$PS1"'\n' # new line
|
||||||
|
PS1="$PS1"'λ ' # prompt: always λ
|
||||||
|
fi
|
||||||
|
|
||||||
|
MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc
|
||||||
|
28
vendor/init.bat
vendored
28
vendor/init.bat
vendored
@ -11,7 +11,11 @@ if not defined verbose-output ( set verbose-output=0 )
|
|||||||
|
|
||||||
:: Find root dir
|
:: Find root dir
|
||||||
if not defined CMDER_ROOT (
|
if not defined CMDER_ROOT (
|
||||||
for /f "delims=" %%i in ("%ConEmuDir%\..\..") do set "CMDER_ROOT=%%~fi"
|
if defined ConEmuDir (
|
||||||
|
for /f "delims=" %%i in ("%ConEmuDir%\..\..") do set "CMDER_ROOT=%%~fi"
|
||||||
|
) else (
|
||||||
|
for /f "delims=" %%i in ("%~dp0\..") do set "CMDER_ROOT=%%~fi"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Remove trailing '\'
|
:: Remove trailing '\'
|
||||||
@ -127,8 +131,8 @@ if not exist "%user-aliases%" (
|
|||||||
type "%user-aliases%" | findstr /i ";= Add aliases below here" >nul
|
type "%user-aliases%" | findstr /i ";= Add aliases below here" >nul
|
||||||
if "!errorlevel!" == "1" (
|
if "!errorlevel!" == "1" (
|
||||||
echo Creating initial user-aliases store in "%user-aliases%"...
|
echo Creating initial user-aliases store in "%user-aliases%"...
|
||||||
copy "%CMDER_ROOT%\%user-aliases%" "%user-aliases%.old_format"
|
copy "%CMDER_ROOT%\%user-aliases%" "%user-aliases%.old_format"
|
||||||
copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%"
|
copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%user-aliases%"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -149,21 +153,14 @@ call "%user-aliases%"
|
|||||||
:: manually extracting the archive rather than executing the 7z sfx
|
:: manually extracting the archive rather than executing the 7z sfx
|
||||||
if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
|
if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
|
||||||
call :verbose-output Running Git for Windows one time Post Install....
|
call :verbose-output Running Git for Windows one time Post Install....
|
||||||
cd /d "%CMDER_ROOT%\vendor\git-for-windows\"
|
pushd "%CMDER_ROOT%\vendor\git-for-windows\"
|
||||||
"%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
|
"%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
|
||||||
cd /d %USERPROFILE%
|
popd
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Set home path
|
:: Set home path
|
||||||
if not defined HOME set "HOME=%USERPROFILE%"
|
if not defined HOME set "HOME=%USERPROFILE%"
|
||||||
|
|
||||||
:: This is either a env variable set by the user or the result of
|
|
||||||
:: cmder.exe setting this variable due to a commandline argument or a "cmder here"
|
|
||||||
if defined CMDER_START (
|
|
||||||
cd /d "%CMDER_START%"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if exist "%CMDER_ROOT%\config\user-profile.cmd" (
|
if exist "%CMDER_ROOT%\config\user-profile.cmd" (
|
||||||
REM Create this file and place your own command in there
|
REM Create this file and place your own command in there
|
||||||
call "%CMDER_ROOT%\config\user-profile.cmd"
|
call "%CMDER_ROOT%\config\user-profile.cmd"
|
||||||
@ -173,7 +170,14 @@ if exist "%CMDER_ROOT%\config\user-profile.cmd" (
|
|||||||
echo :: use this file to run your own startup commands
|
echo :: use this file to run your own startup commands
|
||||||
echo :: use in front of the command to prevent printing the command
|
echo :: use in front of the command to prevent printing the command
|
||||||
echo.
|
echo.
|
||||||
|
echo :: uncomment this to have the ssh agent load when cmder starts
|
||||||
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
|
echo :: call "%%GIT_INSTALL_ROOT%%/cmd/start-ssh-agent.cmd"
|
||||||
|
echo.
|
||||||
|
echo :: uncomment this next two lines to use pageant as the ssh authentication agent
|
||||||
|
echo :: 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 :: set "PATH=%%CMDER_ROOT%%\vendor\whatever;%%PATH%%"
|
||||||
echo.
|
echo.
|
||||||
) > "%CMDER_ROOT%\config\user-profile.cmd"
|
) > "%CMDER_ROOT%\config\user-profile.cmd"
|
||||||
|
91
vendor/profile.ps1
vendored
91
vendor/profile.ps1
vendored
@ -4,23 +4,31 @@
|
|||||||
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
||||||
# !!! Use "%CMDER_ROOT%\config\user-profile.ps1" to add your own startup commands
|
# !!! Use "%CMDER_ROOT%\config\user-profile.ps1" to add your own startup commands
|
||||||
|
|
||||||
# We do this for Powershell as Admin Sessions because CMDER_ROOT is not beng set.
|
|
||||||
if (! $ENV:CMDER_ROOT ) {
|
|
||||||
$ENV:CMDER_ROOT = resolve-path( $ENV:ConEmuDir + "\..\.." )
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove trailing '\'
|
|
||||||
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
|
|
||||||
|
|
||||||
# Compatibility with PS major versions <= 2
|
# Compatibility with PS major versions <= 2
|
||||||
if(!$PSScriptRoot) {
|
if(!$PSScriptRoot) {
|
||||||
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
|
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# We do this for Powershell as Admin Sessions because CMDER_ROOT is not beng set.
|
||||||
|
if (! $ENV:CMDER_ROOT ) {
|
||||||
|
if ( $ENV:ConEmuDir ) {
|
||||||
|
$ENV:CMDER_ROOT = resolve-path( $ENV:ConEmuDir + "\..\.." )
|
||||||
|
} else {
|
||||||
|
$ENV:CMDER_ROOT = resolve-path( $PSScriptRoot + "\.." )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove trailing '\'
|
||||||
|
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
|
||||||
|
|
||||||
|
# do not load bundled psget if a module installer is already available
|
||||||
|
# -> recent PowerShell versions include PowerShellGet out of the box
|
||||||
|
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null)
|
||||||
|
|
||||||
# Add Cmder modules directory to the autoload path.
|
# Add Cmder modules directory to the autoload path.
|
||||||
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
|
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
|
||||||
|
|
||||||
if( -not $env:PSModulePath.Contains($CmderModulePath) ){
|
if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderModulePath) ){
|
||||||
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,13 +80,6 @@ function checkGit($Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move to the wanted location
|
|
||||||
# This is either a env variable set by the user or the result of
|
|
||||||
# cmder.exe setting this variable due to a commandline argument or a "cmder here"
|
|
||||||
if ( $ENV:CMDER_START ) {
|
|
||||||
Set-Location -Path "$ENV:CMDER_START"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
||||||
Set-PSReadlineOption -ExtraPromptLineCount 1
|
Set-PSReadlineOption -ExtraPromptLineCount 1
|
||||||
}
|
}
|
||||||
@ -86,19 +87,6 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
|||||||
# Enhance Path
|
# Enhance Path
|
||||||
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
|
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
|
||||||
|
|
||||||
# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d"
|
|
||||||
# to source them at startup.
|
|
||||||
if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
|
|
||||||
mkdir "$ENV:CMDER_ROOT\config\profile.d"
|
|
||||||
}
|
|
||||||
|
|
||||||
pushd $ENV:CMDER_ROOT\config\profile.d
|
|
||||||
foreach ($x in ls *.ps1) {
|
|
||||||
# write-host write-host Sourcing $x
|
|
||||||
. $x
|
|
||||||
}
|
|
||||||
popd
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Prompt Section
|
# Prompt Section
|
||||||
# Users should modify their user-profile.ps1 as it will be safe from updates.
|
# Users should modify their user-profile.ps1 as it will be safe from updates.
|
||||||
@ -113,6 +101,35 @@ popd
|
|||||||
checkGit($pwd.ProviderPath)
|
checkGit($pwd.ProviderPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
This scriptblock runs every time the prompt is returned.
|
||||||
|
Explicitly use functions from MS namespace to protect from being overridden in the user session.
|
||||||
|
Custom prompt functions are loaded in as constants to get the same behaviour
|
||||||
|
#>
|
||||||
|
[ScriptBlock]$Prompt = {
|
||||||
|
$realLASTEXITCODE = $LASTEXITCODE
|
||||||
|
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
|
||||||
|
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
||||||
|
CmderPrompt
|
||||||
|
Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray"
|
||||||
|
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
||||||
|
$global:LASTEXITCODE = $realLASTEXITCODE
|
||||||
|
return " "
|
||||||
|
}
|
||||||
|
|
||||||
|
# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d"
|
||||||
|
# to source them at startup.
|
||||||
|
if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
|
||||||
|
mkdir "$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
|
||||||
|
}
|
||||||
|
popd
|
||||||
|
|
||||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
|
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
|
||||||
if(Test-Path $CmderUserProfilePath) {
|
if(Test-Path $CmderUserProfilePath) {
|
||||||
# Create this file and place your own command in there.
|
# Create this file and place your own command in there.
|
||||||
@ -160,22 +177,6 @@ Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant
|
|||||||
Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant
|
Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant
|
||||||
Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant
|
Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant
|
||||||
|
|
||||||
<#
|
|
||||||
This scriptblock runs every time the prompt is returned.
|
|
||||||
Explicitly use functions from MS namespace to protect from being overridden in the user session.
|
|
||||||
Custom prompt functions are loaded in as constants to get the same behaviour
|
|
||||||
#>
|
|
||||||
[ScriptBlock]$Prompt = {
|
|
||||||
$realLASTEXITCODE = $LASTEXITCODE
|
|
||||||
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
|
|
||||||
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
|
||||||
CmderPrompt
|
|
||||||
Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray"
|
|
||||||
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
|
|
||||||
$global:LASTEXITCODE = $realLASTEXITCODE
|
|
||||||
return " "
|
|
||||||
}
|
|
||||||
|
|
||||||
# Functions can be made constant only at creation time
|
# Functions can be made constant only at creation time
|
||||||
# ReadOnly at least requires `-force` to be overwritten
|
# ReadOnly at least requires `-force` to be overwritten
|
||||||
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
|
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
|
||||||
|
16
vendor/sources.json
vendored
16
vendor/sources.json
vendored
@ -1,22 +1,22 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "git-for-windows",
|
"name": "git-for-windows",
|
||||||
"version": "v2.11.0.windows.1",
|
"version": "v2.16.1.windows.4",
|
||||||
"url": "https://github.com/git-for-windows/git/releases/download/v2.11.0.windows.1/PortableGit-2.11.0-32-bit.7z.exe"
|
"url": "https://github.com/git-for-windows/git/releases/download/v2.16.1.windows.4/PortableGit-2.16.1.4-64-bit.7z.exe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "clink",
|
"name": "clink",
|
||||||
"version": "0.4.8",
|
"version": "0.4.9",
|
||||||
"url": "https://github.com/mridgers/clink/releases/download/0.4.8/clink_0.4.8.zip"
|
"url": "https://github.com/mridgers/clink/releases/download/0.4.9/clink_0.4.9.zip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "conemu-maximus5",
|
"name": "conemu-maximus5",
|
||||||
"version": "161022",
|
"version": "180206",
|
||||||
"url": "https://github.com/Maximus5/ConEmu/releases/download/v16.10.22/ConEmuPack.161022.7z"
|
"url": "https://github.com/Maximus5/ConEmu/releases/download/v18.02.06/ConEmuPack.180206.7z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "clink-completions",
|
"name": "clink-completions",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.2.zip"
|
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.3.zip"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user