Skip to content

Commit

Permalink
Merge pull request #1822 from cornfeedhobo/stop-changing-working-dire…
Browse files Browse the repository at this point in the history
…ctory

use absolute paths instead of changing directory
  • Loading branch information
cornfeedhobo authored Feb 3, 2021
2 parents ce6487f + 8fcf713 commit ff2f961
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/reloader.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
BASH_IT_LOG_PREFIX="core: reloader: "
pushd "${BASH_IT}" >/dev/null || exit 1

function _set-prefix-based-on-path()
{
Expand All @@ -9,7 +8,7 @@ function _set-prefix-based-on-path()
BASH_IT_LOG_PREFIX="$extension: $filename: "
}

if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
if [[ "$1" != "skip" ]] && [[ -d "$BASH_IT/enabled" ]]; then
_bash_it_config_type=""

case $1 in
Expand All @@ -20,7 +19,7 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
_log_debug "Loading all enabled components..." ;;
esac

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 "$BASH_IT/enabled/*${_bash_it_config_type}.bash")); do
if [ -e "${_bash_it_config_file}" ]; then
_set-prefix-based-on-path "${_bash_it_config_file}"
_log_debug "Loading component..."
Expand All @@ -32,12 +31,12 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
done
fi

if [ -n "${2}" ] && [ -d "${2}/enabled" ]; then
if [[ -n "${2}" ]] && [[ -d "$BASH_IT/${2}/enabled" ]]; then
case $2 in
aliases|completion|plugins)
_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
if [ -e "$_bash_it_config_file" ]; then
for _bash_it_config_file in $(sort <(compgen -G "$BASH_IT/${2}/enabled/*.bash")); do
if [[ -e "$_bash_it_config_file" ]]; then
_set-prefix-based-on-path "${_bash_it_config_file}"
_log_debug "Loading component..."
# shellcheck source=/dev/null
Expand All @@ -51,4 +50,3 @@ fi

unset _bash_it_config_file
unset _bash_it_config_type
popd >/dev/null || exit 1

0 comments on commit ff2f961

Please sign in to comment.