main: adopt `_bash-it-log-prefix-by-path()`

pull/1902/head
John D Pell 2021-10-16 14:49:43 -07:00 committed by John D Pell
parent 0d346b204f
commit bc95eceb10
1 changed files with 8 additions and 10 deletions

View File

@ -27,9 +27,7 @@ _log_debug "Loading libraries(except appearance)..."
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash" APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
for _bash_it_main_file_lib in "${BASH_IT}/lib"/*.bash; do for _bash_it_main_file_lib in "${BASH_IT}/lib"/*.bash; do
[[ "$_bash_it_main_file_lib" == "$APPEARANCE_LIB" ]] && continue [[ "$_bash_it_main_file_lib" == "$APPEARANCE_LIB" ]] && continue
filename="${_bash_it_main_file_lib##*/}" _bash-it-log-prefix-by-path "${_bash_it_main_file_lib}"
filename="${filename%.bash}"
BASH_IT_LOG_PREFIX="lib: ${filename}: "
_log_debug "Loading library file..." _log_debug "Loading library file..."
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$_bash_it_main_file_lib" source "$_bash_it_main_file_lib"
@ -66,11 +64,13 @@ fi
_log_debug "Loading custom aliases, completion, plugins..." _log_debug "Loading custom aliases, completion, plugins..."
for file_type in "aliases" "completion" "plugins"; do for file_type in "aliases" "completion" "plugins"; do
if [[ -s "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]]; then _bash_it_main_file_custom="${BASH_IT}/${file_type}/custom.${file_type}.bash"
BASH_IT_LOG_PREFIX="${file_type}: custom: " if [[ -s "${_bash_it_main_file_custom}" ]]; then
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
_log_debug "Loading component..." _log_debug "Loading component..."
# shellcheck source-path=SCRIPTDIR/aliases source-path=SCRIPTDIR/completions source-path=SCRIPTDIR/plugins
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${BASH_IT}/${file_type}/custom.${file_type}.bash" source "${_bash_it_main_file_custom}"
fi fi
BASH_IT_LOG_PREFIX="core: main: " BASH_IT_LOG_PREFIX="core: main: "
done done
@ -79,9 +79,7 @@ done
_log_debug "Loading general custom files..." _log_debug "Loading general custom files..."
for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/*/*.bash; do for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/*/*.bash; do
if [[ -s "${_bash_it_main_file_custom}" ]]; then if [[ -s "${_bash_it_main_file_custom}" ]]; then
filename="${_bash_it_main_file_custom##*/}" _bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
filename="${filename%*.bash}"
BASH_IT_LOG_PREFIX="custom: $filename: "
_log_debug "Loading custom file..." _log_debug "Loading custom file..."
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$_bash_it_main_file_custom" source "$_bash_it_main_file_custom"
@ -111,4 +109,4 @@ fi
for _bash_it_library_finalize_f in "${_bash_it_library_finalize_hook[@]:-}"; do for _bash_it_library_finalize_f in "${_bash_it_library_finalize_hook[@]:-}"; do
eval "${_bash_it_library_finalize_f?}" # Use `eval` to achieve the same behavior as `$PROMPT_COMMAND`. eval "${_bash_it_library_finalize_f?}" # Use `eval` to achieve the same behavior as `$PROMPT_COMMAND`.
done done
unset "${!_bash_it_library_finalize_@}" "${!_bash_it_main_file_@}" filename file_type unset "${!_bash_it_library_finalize_@}" "${!_bash_it_main_file_@}" file_type