mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-14 05:37:51 +08:00
53
vendor/cmder.sh
vendored
Normal file
53
vendor/cmder.sh
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# DO NOT EDIT THIS FILE IT WILL BE OVERWRITTEN ON UPDATE
|
||||
#
|
||||
# Add portable user customizations ${CMDER_ROOT}/config/user-cmder.sh,
|
||||
# these customizations will follow Cmder if $CMDER_ROOT is copied
|
||||
# to another machine.
|
||||
#
|
||||
# Add system specific users customizations to $HOME/.bashrc, these
|
||||
# customizations will not follow Cmder to another machine.
|
||||
|
||||
# We do this for bash as admin sessions since $CMDER_ROOT is not being set
|
||||
if [ "$CMDER_ROOT" == "" ] ; then
|
||||
case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac
|
||||
else
|
||||
case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac
|
||||
fi
|
||||
|
||||
# Remove any trailing '/'
|
||||
CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::')
|
||||
|
||||
export CMDER_ROOT
|
||||
|
||||
if [ -d "/c/Program Files/Git" ] ; then
|
||||
GIT_INSTALL_ROOT="/c/Program Files/Git"
|
||||
elif [ -d "/c/Program Files(x86)/Git" ] ; then
|
||||
GIT_INSTALL_ROOT="/c/Program Files(x86)/Git"
|
||||
elif [ -d "${CMDER_ROOT}/vendor/git-for-windows" ] ; then
|
||||
GIT_INSTALL_ROOT=${CMDER_ROOT}/vendor/git-for-windows
|
||||
fi
|
||||
|
||||
if [[ ! "$PATH" =~ "${GIT_INSTALL_ROOT}/bin:" ]] ; then
|
||||
PATH=${GIT_INSTALL_ROOT}/bin:$PATH
|
||||
fi
|
||||
|
||||
PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT}
|
||||
|
||||
export PATH
|
||||
|
||||
if [ -f ${CMDER_ROOT}/config/user-cmder.sh ] ; then
|
||||
. ${CMDER_ROOT}/config/user-cmder.sh
|
||||
else
|
||||
echo Creating user startup file: "${CMDER_ROOT}/config/user-cmder.sh"
|
||||
cat <<-eof >"${CMDER_ROOT}/config/user-cmder.sh"
|
||||
# use this file to run your own startup commands for msys2 bash'
|
||||
|
||||
# To add a new vendor to the path, do something like:
|
||||
# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH}
|
||||
eof
|
||||
fi
|
||||
|
||||
# Source the users .bashrc file if it exists
|
||||
if [ -f "${HOME}/.bashrc" ] ; then
|
||||
. "${HOME}/.bashrc"
|
||||
fi
|
11
vendor/init.bat
vendored
11
vendor/init.bat
vendored
@ -9,6 +9,7 @@
|
||||
for /f "delims=" %%i in ("%ConEmuDir%\..\..") do @set CMDER_ROOT=%%~fi
|
||||
)
|
||||
|
||||
:: Remove trailing '\'
|
||||
@if "%CMDER_ROOT:~-1%" == "\" SET CMDER_ROOT=%CMDER_ROOT:~0,-1%
|
||||
|
||||
:: Change the prompt style
|
||||
@ -53,6 +54,16 @@
|
||||
:: Add aliases
|
||||
@doskey /macrofile="%CMDER_ROOT%\config\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
|
||||
:: manually extracting the archive rather than executing the 7z sfx
|
||||
@if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
|
||||
echo Running Git for Windows one time Post Install....
|
||||
cd /d "%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
|
||||
cd /d %USERPROFILE%
|
||||
)
|
||||
|
||||
:: Set home path
|
||||
@if not defined HOME set HOME=%USERPROFILE%
|
||||
|
||||
|
12
vendor/profile.ps1
vendored
12
vendor/profile.ps1
vendored
@ -4,6 +4,14 @@
|
||||
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
||||
# !!! 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
|
||||
if(!$PSScriptRoot) {
|
||||
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||
@ -26,7 +34,7 @@ try {
|
||||
# Check if git is on PATH, i.e. Git already installed on system
|
||||
Get-command -Name "git" -ErrorAction Stop >$null
|
||||
} catch {
|
||||
$env:Path += ";$env:CMDER_ROOT\vendor\git-for-windows\bin"
|
||||
$env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\bin")
|
||||
}
|
||||
|
||||
try {
|
||||
@ -92,7 +100,7 @@ if ( $cmderStart ) {
|
||||
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
|
||||
|
||||
|
||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config/user-profile.ps1"
|
||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
|
||||
if(Test-Path $CmderUserProfilePath) {
|
||||
# Create this file and place your own command in there.
|
||||
. "$CmderUserProfilePath"
|
||||
|
Reference in New Issue
Block a user