Attempt to simplify by not using aliases
MODIFY
bash_it.sh
bash_it.sh
@@ -39,16 +39,12 @@ done
# Load the global "enabled" directory
# "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
+source "${BASH_IT}/scripts/reloader.bash"
# Load enabled aliases, completion, plugins
for file_type in "aliases" "plugins" "completion"
do
- for _bash_it_config_file in $(_list_bash_it_files "$file_type") ; do
- . "${BASH_IT}/$_bash_it_config_file"
- done
+ source "${BASH_IT}/scripts/reloader.bash" "false" "$file_type"
done
# Load theme, if a theme was set

MODIFY
lib/helpers.bash
lib/helpers.bash
@@ -36,39 +36,8 @@ function _list_bash_it_files() {
popd >/dev/null
}
-function _list_global_bash_it_files() {
- local family="$1"
- pushd "${BASH_IT}" >/dev/null
-
- # In the new structure
- if [ -d "./enabled" ]
- then
- local FILES="./enabled/*$family.bash"
- local _bash_it_config_file
-
- for _bash_it_config_file in $FILES
- do
- if [ -e "${_bash_it_config_file}" ]; then
- printf "$_bash_it_config_file\n"
- fi
- done
- fi
-
- popd >/dev/null
-}
-
function _make_reload_alias() {
- local global_family="$1"
- local subdirectory="$2"
-
- printf %s '
- for _bash_it_config_file in $(_list_global_bash_it_files '"$global_family"'); do
- . "${BASH_IT}/$_bash_it_config_file"
- done ;\
- for _bash_it_config_file in $(_list_bash_it_files '"$subdirectory"'); do
- . "${BASH_IT}/$_bash_it_config_file"
- done ;\
- unset _bash_it_config_file'
+ echo "source \${BASH_IT}/scripts/reloader.bash ${1} ${2}"
}
# Alias for reloading aliases

ADD
scripts/reloader.bash
+#!/bin/bash
+pushd "${BASH_IT}" >/dev/null
+
+# TODO: Add debugging output
+
+if [ "$1" != "false" ] && [ -d "./enabled" ]; then
+ for _bash_it_config_file in $(ls ./enabled/*${1}.bash 2>/dev/null); do
+ if [ -e "${_bash_it_config_file}" ]; then
+ source $_bash_it_config_file
+ else
+ echo "Unable to read ${_bash_it_config_file}" > /dev/stderr
+ fi
+ done
+fi
+
+
+if [ ! -z "${2}" ] && [ -d "${2}/enabled" ]; then
+ # TODO: We should warn users they're using legacy enabling
+ for _bash_it_config_file in $(ls ./${2}/enabled/*.bash 2>/dev/null); do
+ if [ -e "$_bash_it_config_file" ]; then
+ source "$_bash_it_config_file"
+ else
+ # TODO Display an error?
+ echo "Unable to locate ${_bash_it_config_file}" > /dev/null
+ fi
+ done
+fi
+
+unset _bash_it_config_file
+popd >/dev/null

Attempt to simplify by not using aliases