scripts: Add logs to reloader.bash
This commit is contained in:
@@ -1,15 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
BASH_IT_LOG_PREFIX="core: reloader: "
|
||||||
pushd "${BASH_IT}" >/dev/null || exit 1
|
pushd "${BASH_IT}" >/dev/null || exit 1
|
||||||
|
|
||||||
# TODO: Add debugging output
|
function _set-prefix-based-on-path()
|
||||||
|
{
|
||||||
|
filename=$(_bash-it-get-component-name-from-path "$1")
|
||||||
|
extension=$(_bash-it-get-component-type-from-path "$1")
|
||||||
|
BASH_IT_LOG_PREFIX="$extension: $filename: "
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
|
if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
|
||||||
_bash_it_config_type=""
|
_bash_it_config_type=""
|
||||||
if [[ "${1}" =~ ^(alias|completion|plugin)$ ]]; then
|
if [[ "${1}" =~ ^(alias|completion|plugin)$ ]]; then
|
||||||
_bash_it_config_type=$1
|
_bash_it_config_type=$1
|
||||||
|
_log_debug "Loading enabled $1 components..."
|
||||||
|
else
|
||||||
|
_log_debug "Loading all enabled components..."
|
||||||
fi
|
fi
|
||||||
for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do
|
for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do
|
||||||
if [ -e "${_bash_it_config_file}" ]; then
|
if [ -e "${_bash_it_config_file}" ]; then
|
||||||
|
_set-prefix-based-on-path "${_bash_it_config_file}"
|
||||||
|
_log_debug "Loading component..."
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source $_bash_it_config_file
|
source $_bash_it_config_file
|
||||||
else
|
else
|
||||||
@@ -20,9 +31,11 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${2}/enabled" ]; then
|
if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${2}/enabled" ]; then
|
||||||
# TODO: We should warn users they're using legacy enabling
|
_log_warning "Using legacy enabling for $2, please update your bash-it version and migrate"
|
||||||
for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do
|
for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do
|
||||||
if [ -e "$_bash_it_config_file" ]; then
|
if [ -e "$_bash_it_config_file" ]; then
|
||||||
|
_set-prefix-based-on-path "${_bash_it_config_file}"
|
||||||
|
_log_debug "Loading component..."
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "$_bash_it_config_file"
|
source "$_bash_it_config_file"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user