[cleanup] Harmonized variable names, added support for global config files

This commit is contained in:
caguettaz
2018-12-04 14:30:11 +01:00
parent 2f3d4bd130
commit f06439edc3
2 changed files with 42 additions and 33 deletions

View File

@@ -29,31 +29,28 @@ cite _about _param _example _group _author _version
# libraries, but skip appearance (themes) for now
LIB="${BASH_IT}/lib/*.bash"
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
for config_file in $LIB
for _bash_it_config_file in $LIB
do
if [ "$config_file" != "$APPEARANCE_LIB" ]; then
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then
# shellcheck disable=SC1090
source "$config_file"
source "$_bash_it_config_file"
fi
done
# Load the global "enabled" directory
_load_global_bash_it_files
# "family" param is empty so that files get sources in glob order
for _bash_it_config_file in $(_list_global_bash_it_files "") ; do
. "${BASH_IT}/$_bash_it_config_file"
done
# Load enabled aliases, completion, plugins
for file_type in "aliases" "plugins" "completion"
do
_bash_it_list_bash_it_files_return=()
_list_bash_it_files $file_type
for config_file in "${_bash_it_list_bash_it_files_return[@]}" ; do
. "$config_file"
for _bash_it_config_file in $(_list_bash_it_files "$file_type") ; do
. "${BASH_IT}/$_bash_it_config_file"
done
done
unset _bash_it_list_bash_it_files_return
unset _bash_it_config_file
# Load theme, if a theme was set
if [[ ! -z "${BASH_IT_THEME}" ]]; then
# Load colors and helpers first so they can be used in base theme
@@ -83,15 +80,15 @@ done
# Custom
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
for config_file in $CUSTOM
for _bash_it_config_file in $CUSTOM
do
if [ -e "${config_file}" ]; then
if [ -e "${_bash_it_config_file}" ]; then
# shellcheck disable=SC1090
source "$config_file"
source "$_bash_it_config_file"
fi
done
unset config_file
unset _bash_it_config_file
if [[ $PROMPT ]]; then
export PS1="\[""$PROMPT""\]"
fi