Merge branch 'master' into patch-2

# Conflicts:
#	vendor/profile.ps1
This commit is contained in:
刘祺 2017-08-03 18:32:44 +08:00
commit 7ca2f5503a
8 changed files with 91 additions and 32 deletions

View File

@ -112,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.

View File

@ -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

View File

@ -548,14 +548,14 @@
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/> <value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/>
<value name="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 &quot;%ConEmuDir%\..\git-for-windows\bin\bash --login -i&quot; -new_console:d:%USERPROFILE%"/> <value name="Cmd1" type="string" data="*cmd /c &quot;%ConEmuDir%\..\git-for-windows\bin\bash&quot; --login -i -new_console:d:%USERPROFILE%"/>
</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 &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/> <value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\icons\cmder.ico&quot;"/>
<value name="Cmd1" type="string" data="cmd /c &quot;%ConEmuDir%\..\git-for-windows\bin\bash --login -i&quot; -new_console:d:%USERPROFILE%"/> <value name="Cmd1" type="string" data="cmd /c &quot;%ConEmuDir%\..\git-for-windows\bin\bash&quot; --login -i -new_console:d:%USERPROFILE%"/>
<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>

View File

@ -95,7 +95,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 };
@ -180,6 +180,10 @@ void StartCmder(std::wstring path, bool is_single_mode)
swprintf_s(args, L"/Icon \"%s\" /Title Cmder", icoPath); swprintf_s(args, L"/Icon \"%s\" /Title Cmder", icoPath);
} }
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 (!streqi(path.c_str(), L""))
{ {
@ -323,6 +327,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 +343,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;
} }

57
vendor/git-prompt.sh vendored
View File

@ -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

7
vendor/init.bat vendored
View File

@ -173,7 +173,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"

6
vendor/profile.ps1 vendored
View File

@ -21,10 +21,14 @@ if (! $ENV:CMDER_ROOT ) {
# Remove trailing '\' # Remove trailing '\'
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\")) $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;")
} }

8
vendor/sources.json vendored
View File

@ -1,8 +1,8 @@
[ [
{ {
"name": "git-for-windows", "name": "git-for-windows",
"version": "v2.13.1.windows.1", "version": "v2.13.3.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.13.1.windows.1/PortableGit-2.13.1-32-bit.7z.exe" "url": "https://github.com/git-for-windows/git/releases/download/v2.13.3.windows.1/PortableGit-2.13.3-32-bit.7z.exe"
}, },
{ {
"name": "clink", "name": "clink",
@ -11,8 +11,8 @@
}, },
{ {
"name": "conemu-maximus5", "name": "conemu-maximus5",
"version": "170605", "version": "170622",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v17.06.05/ConEmuPack.170605.7z" "url": "https://github.com/Maximus5/ConEmu/releases/download/v17.06.22/ConEmuPack.170622.7z"
}, },
{ {
"name": "clink-completions", "name": "clink-completions",