-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
Hi,
Currently, the sourcing order of the customized scripts are controlled by the following code snippet in https://github.com/Bash-it/bash-it/blob/master/bash_it.sh:
# Custom
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
for _bash_it_config_file in $CUSTOM
do
if [ -e "${_bash_it_config_file}" ]; then
# shellcheck disable=SC1090
source "$_bash_it_config_file"
fi
done
But this is not so convenient if we wan to have more control on the sourcing order of the customized scripts.
So, I suggest the following codes for doing the job instead of the above ones:
# Custom
# A more convenient method for controlling the sourcing order of customized scripts:
# The scripts in begin folder will be sourced firstly and the ones in the end folder will be
# sourced lastly.
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/begin/*.bash \
${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash \
${BASH_IT_CUSTOM:=${BASH_IT}/custom}/end/*.bash"
for _bash_it_config_file in $CUSTOM
do
if [ -e "${_bash_it_config_file}" ]; then
# shellcheck disable=SC1090
source "$_bash_it_config_file"
fi
done
Any comments on this idea? If you agree, I will make a PR.
Regards
giggio