From 1ba023c97a33c2ac87abb46ac75a9afdd585ba5b Mon Sep 17 00:00:00 2001 From: Christophe Aguettaz Date: Fri, 23 Nov 2018 22:25:14 +0100 Subject: [PATCH 01/15] [bugfix][wip] Fixed issue with Debian's bash-completion --- bash_it.sh | 10 +++++++++- lib/helpers.bash | 37 +++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index e2b00de7..82b7e1b9 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -43,9 +43,17 @@ _load_global_bash_it_files # Load enabled aliases, completion, plugins for file_type in "aliases" "plugins" "completion" do - _load_bash_it_files $file_type + _bash_it_list_bash_it_files_return=() + _list_bash_it_files $file_type + + for config_file in "${_bash_it_list_bash_it_files_return[@]}" ; do + . "$config_file" + done done +unset _bash_it_list_bash_it_files_return +unset _bash_it_config_file + # Load theme, if a theme was set if [[ ! -z "${BASH_IT_THEME}" ]]; then # Load colors and helpers first so they can be used in base theme diff --git a/lib/helpers.bash b/lib/helpers.bash index 565173ed..bb592bab 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -14,16 +14,18 @@ function _command_exists () type "$1" &> /dev/null ; } -# Helper function loading various enable-able files -function _load_bash_it_files() { +# Helper function listing various enable-able files to be sourced +# The files need to be sourced in global scope to preserve scope of 'declare' +function _list_bash_it_files() { subdirectory="$1" if [ -d "${BASH_IT}/${subdirectory}/enabled" ] then FILES="${BASH_IT}/${subdirectory}/enabled/*.bash" - for config_file in $FILES + + for _bash_it_config_file in $FILES do - if [ -e "${config_file}" ]; then - source $config_file + if [ -e "${_bash_it_config_file}" ]; then + _bash_it_list_bash_it_files_return+=("$_bash_it_config_file") fi done fi @@ -43,20 +45,23 @@ function _load_global_bash_it_files() { fi } -# Function for reloading aliases -function reload_aliases() { - _load_bash_it_files "aliases" +function _make_reload_alias() { + printf %s '\ + _bash_it_list_bash_it_files_return=() ;\ + _list_bash_it_files '"$1"' ;\ + for _bash_it_config_file in "${_bash_it_list_bash_it_files_return[@]}"; do \ + . "$_bash_it_config_file" ;\ + done' } -# Function for reloading auto-completion -function reload_completion() { - _load_bash_it_files "completion" -} +# Alias for reloading aliases +alias reload_aliases="$(_make_reload_alias aliases)" -# Function for reloading plugins -function reload_plugins() { - _load_bash_it_files "plugins" -} +# Alias for reloading auto-completion +alias reload_completion="$(_make_reload_alias completion)" + +# Alias for reloading plugins +alias reload_plugins="$(_make_reload_alias plugins)" bash-it () { From 2f3d4bd1300960b47f44f4403e1cd390ed1cb2b1 Mon Sep 17 00:00:00 2001 From: Christophe Aguettaz Date: Fri, 23 Nov 2018 22:59:19 +0100 Subject: [PATCH 02/15] [cleanup] Added missing global variable cleanup --- lib/helpers.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index bb592bab..9c3e53f7 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -51,7 +51,9 @@ function _make_reload_alias() { _list_bash_it_files '"$1"' ;\ for _bash_it_config_file in "${_bash_it_list_bash_it_files_return[@]}"; do \ . "$_bash_it_config_file" ;\ - done' + done ;\ + unset _bash_it_list_bash_it_files_return ;\ + unset _bash_it_config_file' } # Alias for reloading aliases From f06439edc354d354eb3c2573008b8e7d206e8cde Mon Sep 17 00:00:00 2001 From: caguettaz Date: Tue, 4 Dec 2018 14:30:11 +0100 Subject: [PATCH 03/15] [cleanup] Harmonized variable names, added support for global config files --- bash_it.sh | 29 +++++++++++++---------------- lib/helpers.bash | 46 +++++++++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 82b7e1b9..1d34b407 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -29,31 +29,28 @@ cite _about _param _example _group _author _version # libraries, but skip appearance (themes) for now LIB="${BASH_IT}/lib/*.bash" APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash" -for config_file in $LIB +for _bash_it_config_file in $LIB do - if [ "$config_file" != "$APPEARANCE_LIB" ]; then + if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then # shellcheck disable=SC1090 - source "$config_file" + source "$_bash_it_config_file" fi done # Load the global "enabled" directory -_load_global_bash_it_files +# "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 # Load enabled aliases, completion, plugins for file_type in "aliases" "plugins" "completion" do - _bash_it_list_bash_it_files_return=() - _list_bash_it_files $file_type - - for config_file in "${_bash_it_list_bash_it_files_return[@]}" ; do - . "$config_file" + for _bash_it_config_file in $(_list_bash_it_files "$file_type") ; do + . "${BASH_IT}/$_bash_it_config_file" done done -unset _bash_it_list_bash_it_files_return -unset _bash_it_config_file - # Load theme, if a theme was set if [[ ! -z "${BASH_IT_THEME}" ]]; then # Load colors and helpers first so they can be used in base theme @@ -83,15 +80,15 @@ done # Custom CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash" -for config_file in $CUSTOM +for _bash_it_config_file in $CUSTOM do - if [ -e "${config_file}" ]; then + if [ -e "${_bash_it_config_file}" ]; then # shellcheck disable=SC1090 - source "$config_file" + source "$_bash_it_config_file" fi done -unset config_file +unset _bash_it_config_file if [[ $PROMPT ]]; then export PS1="\[""$PROMPT""\]" fi diff --git a/lib/helpers.bash b/lib/helpers.bash index 9c3e53f7..3474aece 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -17,42 +17,54 @@ function _command_exists () # Helper function listing various enable-able files to be sourced # The files need to be sourced in global scope to preserve scope of 'declare' function _list_bash_it_files() { - subdirectory="$1" - if [ -d "${BASH_IT}/${subdirectory}/enabled" ] + local subdirectory="$1" + pushd "${BASH_IT}" >/dev/null + + if [ -d "./${subdirectory}/enabled" ] then - FILES="${BASH_IT}/${subdirectory}/enabled/*.bash" + local FILES="./${subdirectory}/enabled/*.bash" + local _bash_it_config_file for _bash_it_config_file in $FILES do if [ -e "${_bash_it_config_file}" ]; then - _bash_it_list_bash_it_files_return+=("$_bash_it_config_file") + printf "$_bash_it_config_file\n" fi done fi + + popd >/dev/null } -function _load_global_bash_it_files() { +function _list_global_bash_it_files() { + local family="$1" + pushd "${BASH_IT}" >/dev/null + # In the new structure - if [ -d "${BASH_IT}/enabled" ] + if [ -d "./enabled" ] then - FILES="${BASH_IT}/enabled/*.bash" - for config_file in $FILES + local FILES="./enabled/*$family.bash" + local _bash_it_config_file + + for _bash_it_config_file in $FILES do - if [ -e "${config_file}" ]; then - source $config_file + if [ -e "${_bash_it_config_file}" ]; then + printf "$_bash_it_config_file\n" fi done fi } function _make_reload_alias() { - printf %s '\ - _bash_it_list_bash_it_files_return=() ;\ - _list_bash_it_files '"$1"' ;\ - for _bash_it_config_file in "${_bash_it_list_bash_it_files_return[@]}"; do \ - . "$_bash_it_config_file" ;\ - done ;\ - unset _bash_it_list_bash_it_files_return ;\ + printf %s ' + + for _bash_it_config_file in $(_list_global_bash_it_files '"$1"'); do \ + . "${BASH_IT}/$_bash_it_config_file" ; + done ; + + for _bash_it_config_file in $(_list_bash_it_files '"$1"'); do + . "${BASH_IT}/$_bash_it_config_file" ; + done ; unset _bash_it_config_file' } From e198d8dc3da11ee5f3aed1ee1bcdf5390478f003 Mon Sep 17 00:00:00 2001 From: caguettaz Date: Tue, 4 Dec 2018 14:58:13 +0100 Subject: [PATCH 04/15] [bugfix] Fixed config family names for reload aliases --- lib/helpers.bash | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 3474aece..a6e4a6f1 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -56,26 +56,28 @@ function _list_global_bash_it_files() { } function _make_reload_alias() { - printf %s ' + local global_family="$1" + local subdirectory="$2" - for _bash_it_config_file in $(_list_global_bash_it_files '"$1"'); do \ + 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 '"$1"'); do + for _bash_it_config_file in $(_list_bash_it_files '"$subdirectory"'); do . "${BASH_IT}/$_bash_it_config_file" ; done ; unset _bash_it_config_file' } # Alias for reloading aliases -alias reload_aliases="$(_make_reload_alias aliases)" +alias reload_aliases="$(_make_reload_alias alias aliases)" # Alias for reloading auto-completion -alias reload_completion="$(_make_reload_alias completion)" +alias reload_completion="$(_make_reload_alias completion completion)" # Alias for reloading plugins -alias reload_plugins="$(_make_reload_alias plugins)" +alias reload_plugins="$(_make_reload_alias plugin plugins)" bash-it () { From a1bbecc4a5d48b92346fb16b5c248b703576f06d Mon Sep 17 00:00:00 2001 From: caguettaz Date: Tue, 4 Dec 2018 15:58:21 +0100 Subject: [PATCH 05/15] [bugfix] Fixed reload aliases --- lib/helpers.bash | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index a6e4a6f1..38cc3ad8 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -53,6 +53,8 @@ function _list_global_bash_it_files() { fi done fi + + popd >/dev/null } function _make_reload_alias() { @@ -61,12 +63,13 @@ function _make_reload_alias() { 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 ; + . "${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' } From 13b6f3d870830aaeec8d2506d697484c1aaf446d Mon Sep 17 00:00:00 2001 From: caguettaz Date: Tue, 4 Dec 2018 16:31:03 +0100 Subject: [PATCH 06/15] [cleanup] Cleaned escaped newlines for alias reload --- lib/helpers.bash | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 38cc3ad8..beba262a 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -62,14 +62,12 @@ function _make_reload_alias() { 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" ;\ + 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" ;\ + for _bash_it_config_file in $(_list_bash_it_files '"$subdirectory"'); do + . "${BASH_IT}/$_bash_it_config_file" done ;\ - \ unset _bash_it_config_file' } From e5b68695c0e77403e9ceda6e2707c1be326da81b Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 4 Dec 2018 22:02:10 -0600 Subject: [PATCH 07/15] Attempt to simplify by not using aliases --- bash_it.sh | 8 ++------ lib/helpers.bash | 33 +-------------------------------- scripts/reloader.bash | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 38 deletions(-) create mode 100644 scripts/reloader.bash diff --git a/bash_it.sh b/bash_it.sh index 1d34b407..8d26bc55 100755 --- a/bash_it.sh +++ b/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 diff --git a/lib/helpers.bash b/lib/helpers.bash index beba262a..fb5d9cc7 100644 --- a/lib/helpers.bash +++ b/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 diff --git a/scripts/reloader.bash b/scripts/reloader.bash new file mode 100644 index 00000000..b208a98c --- /dev/null +++ b/scripts/reloader.bash @@ -0,0 +1,30 @@ +#!/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 From 286e69591046d4a0395ebbf239e6c5aeb2c49500 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 20:59:37 -0600 Subject: [PATCH 08/15] Ensure that shellcheck can find these files (SC1090) --- bash_it.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash_it.sh b/bash_it.sh index 8d26bc55..1b092cc9 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -39,11 +39,13 @@ done # Load the global "enabled" directory # "family" param is empty so that files get sources in glob order +# shellcheck source=./scripts/reloader.bash source "${BASH_IT}/scripts/reloader.bash" # Load enabled aliases, completion, plugins for file_type in "aliases" "plugins" "completion" do + # shellcheck source=./scripts/reloader.bash source "${BASH_IT}/scripts/reloader.bash" "false" "$file_type" done From 61380e686f33482a42776202dbef67b768393e19 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:00:01 -0600 Subject: [PATCH 09/15] Remove unused function --- lib/helpers.bash | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index fb5d9cc7..ed229b3a 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -14,28 +14,6 @@ function _command_exists () type "$1" &> /dev/null ; } -# Helper function listing various enable-able files to be sourced -# The files need to be sourced in global scope to preserve scope of 'declare' -function _list_bash_it_files() { - local subdirectory="$1" - pushd "${BASH_IT}" >/dev/null - - if [ -d "./${subdirectory}/enabled" ] - then - local FILES="./${subdirectory}/enabled/*.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() { echo "source \${BASH_IT}/scripts/reloader.bash ${1} ${2}" } From 0793eb41a716ccb42ec0b23287394715a2430375 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:00:41 -0600 Subject: [PATCH 10/15] =?UTF-8?q?Ignore=20SC2139=20=E2=80=93=20it's=20ok?= =?UTF-8?q?=20that=20these=20are=20expanded=20when=20evaluated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/helpers.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/helpers.bash b/lib/helpers.bash index ed229b3a..d71120b8 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -19,12 +19,15 @@ function _make_reload_alias() { } # Alias for reloading aliases +# shellcheck disable=SC2139 alias reload_aliases="$(_make_reload_alias alias aliases)" # Alias for reloading auto-completion +# shellcheck disable=SC2139 alias reload_completion="$(_make_reload_alias completion completion)" # Alias for reloading plugins +# shellcheck disable=SC2139 alias reload_plugins="$(_make_reload_alias plugin plugins)" bash-it () From 992b87b816c57e6ac2ea195d18cb1ba6888b5552 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:00:59 -0600 Subject: [PATCH 11/15] Shellcheck clean up based on comments from @nwinkler --- scripts/reloader.bash | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/reloader.bash b/scripts/reloader.bash index b208a98c..cac77a21 100644 --- a/scripts/reloader.bash +++ b/scripts/reloader.bash @@ -1,11 +1,12 @@ #!/bin/bash -pushd "${BASH_IT}" >/dev/null +pushd "${BASH_IT}" >/dev/null || exit 1 # TODO: Add debugging output if [ "$1" != "false" ] && [ -d "./enabled" ]; then - for _bash_it_config_file in $(ls ./enabled/*${1}.bash 2>/dev/null); do + for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${1}.bash")); do if [ -e "${_bash_it_config_file}" ]; then + # shellcheck source=/dev/null source $_bash_it_config_file else echo "Unable to read ${_bash_it_config_file}" > /dev/stderr @@ -16,8 +17,9 @@ 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 + for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do if [ -e "$_bash_it_config_file" ]; then + # shellcheck source=/dev/null source "$_bash_it_config_file" else # TODO Display an error? @@ -27,4 +29,4 @@ if [ ! -z "${2}" ] && [ -d "${2}/enabled" ]; then fi unset _bash_it_config_file -popd >/dev/null +popd >/dev/null || exit 1 From c76263dc47b008600602228c374d7ccb90e8cacd Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:04:55 -0600 Subject: [PATCH 12/15] Ensure this debugging output is generated (oops) --- scripts/reloader.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/reloader.bash b/scripts/reloader.bash index cac77a21..66236042 100644 --- a/scripts/reloader.bash +++ b/scripts/reloader.bash @@ -22,8 +22,7 @@ if [ ! -z "${2}" ] && [ -d "${2}/enabled" ]; then # shellcheck source=/dev/null source "$_bash_it_config_file" else - # TODO Display an error? - echo "Unable to locate ${_bash_it_config_file}" > /dev/null + echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr fi done fi From 5b8f8d874e21feb8323e6fc1c919edcafc2a8468 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:53:39 -0600 Subject: [PATCH 13/15] Default to loading everything The tests are failing because $1 is being passed through from the initial loading. When this loads in the shell, $1 is empty though so the code works-for-me, but just not the tests. This filters the $1 input to ensure its one of the valid types expected inside the ./enabled directory. --- scripts/reloader.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/reloader.bash b/scripts/reloader.bash index 66236042..e5cf178f 100644 --- a/scripts/reloader.bash +++ b/scripts/reloader.bash @@ -4,7 +4,11 @@ pushd "${BASH_IT}" >/dev/null || exit 1 # TODO: Add debugging output if [ "$1" != "false" ] && [ -d "./enabled" ]; then - for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${1}.bash")); do + _bash_it_config_type="" + if [[ "${1}" =~ ^(alias|completion|plugin)$ ]]; then + _bash_it_config_type=$1 + fi + for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do if [ -e "${_bash_it_config_file}" ]; then # shellcheck source=/dev/null source $_bash_it_config_file @@ -28,4 +32,5 @@ if [ ! -z "${2}" ] && [ -d "${2}/enabled" ]; then fi unset _bash_it_config_file +unset _bash_it_config_type popd >/dev/null || exit 1 From 7b32dd64241599200a67c38ba1241d926c555be7 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:54:59 -0600 Subject: [PATCH 14/15] Add filtering to the $2 input in addition to $1 --- scripts/reloader.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/reloader.bash b/scripts/reloader.bash index e5cf178f..c26d3626 100644 --- a/scripts/reloader.bash +++ b/scripts/reloader.bash @@ -19,7 +19,7 @@ if [ "$1" != "false" ] && [ -d "./enabled" ]; then fi -if [ ! -z "${2}" ] && [ -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 for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do if [ -e "$_bash_it_config_file" ]; then From 2d6085b033be1af89526a6c46c47d0dfc853051f Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Wed, 5 Dec 2018 21:58:13 -0600 Subject: [PATCH 15/15] =?UTF-8?q?Switch=20from=20false=20to=20skip=20?= =?UTF-8?q?=E2=80=93=20I=20think=20that's=20more=20clear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_it.sh | 2 +- scripts/reloader.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 1b092cc9..ab911019 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -46,7 +46,7 @@ source "${BASH_IT}/scripts/reloader.bash" for file_type in "aliases" "plugins" "completion" do # shellcheck source=./scripts/reloader.bash - source "${BASH_IT}/scripts/reloader.bash" "false" "$file_type" + source "${BASH_IT}/scripts/reloader.bash" "skip" "$file_type" done # Load theme, if a theme was set diff --git a/scripts/reloader.bash b/scripts/reloader.bash index c26d3626..b0fe7e41 100644 --- a/scripts/reloader.bash +++ b/scripts/reloader.bash @@ -3,7 +3,7 @@ pushd "${BASH_IT}" >/dev/null || exit 1 # TODO: Add debugging output -if [ "$1" != "false" ] && [ -d "./enabled" ]; then +if [ "$1" != "skip" ] && [ -d "./enabled" ]; then _bash_it_config_type="" if [[ "${1}" =~ ^(alias|completion|plugin)$ ]]; then _bash_it_config_type=$1