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.
pull/1283/head
Travis Swicegood 2018-12-05 21:53:39 -06:00
parent c76263dc47
commit 5b8f8d874e
1 changed files with 6 additions and 1 deletions

View File

@ -4,7 +4,11 @@ pushd "${BASH_IT}" >/dev/null || exit 1
# TODO: Add debugging output # TODO: Add debugging output
if [ "$1" != "false" ] && [ -d "./enabled" ]; then 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 if [ -e "${_bash_it_config_file}" ]; then
# shellcheck source=/dev/null # shellcheck source=/dev/null
source $_bash_it_config_file source $_bash_it_config_file
@ -28,4 +32,5 @@ if [ ! -z "${2}" ] && [ -d "${2}/enabled" ]; then
fi fi
unset _bash_it_config_file unset _bash_it_config_file
unset _bash_it_config_type
popd >/dev/null || exit 1 popd >/dev/null || exit 1