mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-15 06:07:50 +08:00
Enhanced alias.bat to allow file storage path
This commit is contained in:
8
vendor/aliases.example
vendored
8
vendor/aliases.example
vendored
@ -1,8 +0,0 @@
|
||||
e.=explorer .
|
||||
gl=git log --oneline --all --graph --decorate $*
|
||||
ls=ls --show-control-chars -F --color $*
|
||||
pwd=cd
|
||||
clear=cls
|
||||
history=cat %CMDER_ROOT%\config\.history
|
||||
unalias=alias /d $1
|
||||
vi=vim $*
|
22
vendor/init.bat
vendored
22
vendor/init.bat
vendored
@ -59,15 +59,21 @@
|
||||
:: Enhance Path
|
||||
@set "PATH=%CMDER_ROOT%\bin;%PATH%;%CMDER_ROOT%\"
|
||||
|
||||
|
||||
:: make sure we have an example file
|
||||
@if not exist "%CMDER_ROOT%\config\aliases" (
|
||||
echo Creating intial aliases in %CMDER_ROOT%\config\aliases
|
||||
copy "%CMDER_ROOT%\vendor\aliases.example" "%CMDER_ROOT%\config\aliases" > null
|
||||
@set aliases=%CMDER_ROOT%\config\user-aliases.cmd
|
||||
@if not exist "%aliases%" (
|
||||
echo Creating intial aliases in "%aliases%"...
|
||||
copy "%CMDER_ROOT%\vendor\user-aliases.cmd.example" "%aliases%"
|
||||
)
|
||||
|
||||
:: Add aliases
|
||||
@doskey /macrofile="%CMDER_ROOT%\config\aliases"
|
||||
:: Update old 'aliases' to new self executing 'user-aliases.cmd'
|
||||
@if exist "%CMDER_ROOT%\config\aliases" (
|
||||
echo Updating old "%CMDER_ROOT%\config\aliases" to new format...
|
||||
type "%CMDER_ROOT%\config\aliases" >> "%aliases%" && del "%CMDER_ROOT%\config\aliases"
|
||||
)
|
||||
|
||||
:: Add aliases to the environment.
|
||||
@call "%aliases%"
|
||||
|
||||
:: See vendor\git-for-windows\README.portable for why we do this
|
||||
:: Basically we need to execute this post-install.bat because we are
|
||||
@ -90,9 +96,10 @@
|
||||
|
||||
:: Drop *.bat and *.cmd files into "%CMDER_ROOT%\config\profile.d"
|
||||
:: to run them at startup.
|
||||
|
||||
@if not exist "%CMDER_ROOT%\config\profile.d" (
|
||||
mkdir "%CMDER_ROOT%\config\profile.d"
|
||||
}
|
||||
)
|
||||
|
||||
@pushd "%CMDER_ROOT%\config\profile.d"
|
||||
for /f "usebackq" %%x in ( `dir /b *.bat *.cmd` ) do (
|
||||
@ -101,7 +108,6 @@ for /f "usebackq" %%x in ( `dir /b *.bat *.cmd` ) do (
|
||||
)
|
||||
@popd
|
||||
|
||||
|
||||
@if exist "%CMDER_ROOT%\config\user-profile.cmd" (
|
||||
@rem create this file and place your own command in there
|
||||
call "%CMDER_ROOT%\config\user-profile.cmd"
|
||||
|
15
vendor/user-aliases.cmd.example
vendored
Normal file
15
vendor/user-aliases.cmd.example
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
;= @echo off
|
||||
;= rem Call DOSKEY and use this file as the macrofile
|
||||
;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
|
||||
;= rem In batch mode, jump to the end of the file
|
||||
;= goto:eof
|
||||
;= Add aliases below here
|
||||
e.=explorer .
|
||||
gl=git log --oneline --all --graph --decorate $*
|
||||
ls=ls --show-control-chars -F --color $*
|
||||
pwd=cd
|
||||
clear=cls
|
||||
history=cat %CMDER_ROOT%\config\.history
|
||||
unalias=alias /d $1
|
||||
vi=vim $*
|
||||
cmderr=cd /d "%CMDER_ROOT%"
|
Reference in New Issue
Block a user