From 437fd2a92823614a7429e41ccea454b93991dbe7 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 16 Oct 2021 14:58:18 -0700 Subject: [PATCH] main: simplify flow of lib loader loop Eliminate the separate loop for `vendor/init.d` since it's just as easy to glob it in the `lib` loop. --- bash_it.sh | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 36501e30..2a00d05a 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -30,27 +30,15 @@ fi # libraries, but skip appearance (themes) for now _log_debug "Loading libraries(except appearance)..." APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash" -for _bash_it_lib_file in "${BASH_IT}"/lib/*.bash; do - if [[ "$_bash_it_lib_file" != "$APPEARANCE_LIB" ]]; then - _bash-it-log-prefix-by-path "${_bash_it_lib_file}" - _log_debug "Loading library file..." - # shellcheck source-path=SCRIPTDIR/lib disable=SC1090 - source "$_bash_it_lib_file" - fi +for _bash_it_lib_file in "${BASH_IT}"/lib/*.bash "${BASH_IT}/vendor/init.d"/*.bash; do + [[ "$_bash_it_lib_file" == "$APPEARANCE_LIB" ]] && continue + _bash-it-log-prefix-by-path "${_bash_it_lib_file}" + _log_debug "Loading library file..." + # shellcheck source-path=SCRIPTDIR/lib;SCRIPTDIR/vendor/init.d disable=SC1090 + source "$_bash_it_lib_file" done unset _bash_it_lib_file -# Load vendors -BASH_IT_LOG_PREFIX="vendor: " -for _bash_it_vendor_init in "${BASH_IT}/vendor/init.d"/*.bash; do - filename="${_bash_it_vendor_init##*/}" - filename="${filename%.bash}" - _log_debug "Loading '${filename}'..." - # shellcheck disable=SC1090 - source "${_bash_it_vendor_init}" -done -unset _bash_it_vendor_init filename - BASH_IT_LOG_PREFIX="core: main: " # Load the global "enabled" directory # "family" param is empty so that files get sources in glob order