New cmder.exe args and shared install capability (#1696)

@MartiUK: Squashing to avoid adding multiple "fixed" commits

* add args to init.bat

* adding args to cmder launcher

* reworked command line parsing and added a /C [path] arg for individual user config location

* removed unnecessary includes

* make shell init scripts work with CMDER_USER_CONFIG

* update tasks and readme.md

* fix git version check

* readme updates

* add register/unregister back in

* fixed git version again

* removed error if user defines user-aliases store file was not present an init.bat launch

* added enhance_path method to only update path if required

* added enhance_path method to only update path if required

* fixed a path prepend issue in enhance path

* init.bat with args is executed outside cmder/conemu sets cmder_root properly. Thanks @DRSDavidSoft

* fixed enhance path append issue

* implements recursive `/bin` path enhancing.

https://github.com/cmderdev/cmder/issues/1624

* added max depth

* changes command line arg to max_depth

* set max_depth default

* readme.md updates

* add back cmder /c [path] arg so it can be used with admin sessions since the env is not shared.

* readme.md updates

* fix /c setting of cmder_user_config

* changelog and readme

* remove bad arg

* fixed command line parsing and updated command line help on error

* Fixed ConEmu.xml file handling so it works again

* Added default user config root location if '/c' is specified and next arg is not another arg
This commit is contained in:
Dax T Games
2018-03-13 10:38:27 -05:00
committed by Martin Kemp
parent ff2e09849e
commit 997e799138
10 changed files with 950 additions and 348 deletions

54
vendor/cmder_exinit vendored
View File

@ -22,6 +22,25 @@
# # from outside Cmder.
# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder.
function runProfiled {
unset profile_d_scripts
pushd "${1}" >/dev/null
if [ ! "x${ZSH_VERSION}" = "x" ]; then
profile_d_scripts=$(ls *.zsh 2>/dev/null)
elif [ ! "x${BASH_VERSION}" = "x" ]; then
profile_d_scripts=$(ls *.sh 2>/dev/null)
fi
if [ ! "x${profile_d_scripts}" = "x" ] ; then
for x in ${profile_d_scripts} ; do
echo Sourcing "${1}/${x}"...
. "${1}/${x}"
done
fi
popd >/dev/null
}
# Check that we haven't already been sourced.
[[ -z ${CMDER_EXINIT} ]] && CMDER_EXINIT="1" || return
@ -55,28 +74,29 @@ if [ ! "$CMDER_ROOT" = "" ] ; then
fi
if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then
unset profile_d_scripts
pushd "${CMDER_ROOT}/config/profile.d" >/dev/null
if [ ! "x${ZSH_VERSION}" = "x" ]; then
profile_d_scripts=$(ls *.zsh 2>/dev/null)
elif [ ! "x${BASH_VERSION}" = "x" ]; then
profile_d_scripts=$(ls *.sh 2>/dev/null)
fi
if [ ! "x${profile_d_scripts}" = "x" ] ; then
for x in ${profile_d_scripts} ; do
# echo Sourcing "${CMDER_ROOT}/config/profile.d/${x}"...
. "${CMDER_ROOT}/config/profile.d/${x}"
done
fi
popd >/dev/null
runProfiled "${CMDER_ROOT}/config/profile.d"
fi
if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then
runProfiled "${CMDER_USER_CONFIG}/profile.d"
fi
if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then
. "${CMDER_ROOT}/config/user-profile.sh"
fi
if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then
. "${CMDER_USER_CONFIG}/user-profile.sh"
else
echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh"
cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh"
if [ "${CMDER_USER_CONFIG}" != "" ] ; then
initialProfile="${CMDER_USER_CONFIG}/user-profile.sh"
else
initialProfile="${CMDER_ROOT}/config/user-profile.sh"
fi
echo Creating user startup file: "${initialProfile}"
cat <<-eof >"${initialProfile}"
# use this file to run your own startup commands for msys2 bash'
# To add a new vendor to the path, do something like: