mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-15 06:07:50 +08:00
Added profile.d like support for all supported shells
This commit is contained in:
13
vendor/cmder.sh
vendored
13
vendor/cmder.sh
vendored
@ -35,6 +35,19 @@ PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT}
|
||||
|
||||
export PATH
|
||||
|
||||
# Drop *.sh files into "%CMDER_ROOT%\config\profile.d"
|
||||
# to run them at startup.
|
||||
if [ ! -d ${CMDER_ROOT}/config/profile.d ] ; then
|
||||
mkdir -p "${CMDER_ROOT}/config/profile.d"
|
||||
fi
|
||||
|
||||
pushd ${CMDER_ROOT}/config/profile.d >/dev/null
|
||||
for x in $(ls ${CMDER_ROOT}/config/profile.d/*.sh) ; do
|
||||
# echo ${x}
|
||||
. $x
|
||||
done
|
||||
popd >/dev/null
|
||||
|
||||
if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then
|
||||
. ${CMDER_ROOT}/config/user-profile.sh
|
||||
else
|
||||
|
14
vendor/init.bat
vendored
14
vendor/init.bat
vendored
@ -88,6 +88,20 @@
|
||||
@cd /d "%CMDER_START%"
|
||||
)
|
||||
|
||||
:: 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 (
|
||||
REM @echo Calling %CMDER_ROOT%\config\profile.d\%%x...
|
||||
@call %%x
|
||||
)
|
||||
@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"
|
||||
|
12
vendor/profile.ps1
vendored
12
vendor/profile.ps1
vendored
@ -91,6 +91,18 @@ if ( $ENV:CMDER_START ) {
|
||||
# Enhance Path
|
||||
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
|
||||
|
||||
# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d"
|
||||
# to run 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 Sourcing $ENV:CMDER_ROOT\config\profile.d\$x
|
||||
. $x
|
||||
}
|
||||
|
||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
|
||||
if(Test-Path $CmderUserProfilePath) {
|
||||
# Create this file and place your own command in there.
|
||||
|
Reference in New Issue
Block a user