Optimize as before but with 2nd REGEX instance

This time is much like the last commit, so I won't repeat, but I will
say that you're using a double- or even triple-negative, which
obfuscates your goal. Where you were doing...

[ ! -n VAR ] &&

You were basically saying this convolution:

If it's true that it's not true that VAR is not empty.

Very confusing. Instead, I've opted for:

If it's true that Var is empty.

Makes immediate sense and is easier to parse, visually speaking.
pull/1749/head
terminalforlife 2020-12-19 01:57:24 +00:00
parent 24b2f2d2e9
commit cb8f034f76
1 changed files with 15 additions and 13 deletions

View File

@ -32,19 +32,21 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
done done
fi fi
if [ -n "${2}" ] && [ -d "${2}/enabled" ]; then
if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${2}/enabled" ]; then case $2 in
_log_warning "Using legacy enabling for $2, please update your bash-it version and migrate" aliases|completion|plugins)
for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do _log_warning "Using legacy enabling for $2, please update your bash-it version and migrate"
if [ -e "$_bash_it_config_file" ]; then for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do
_set-prefix-based-on-path "${_bash_it_config_file}" if [ -e "$_bash_it_config_file" ]; then
_log_debug "Loading component..." _set-prefix-based-on-path "${_bash_it_config_file}"
# shellcheck source=/dev/null _log_debug "Loading component..."
source "$_bash_it_config_file" # shellcheck source=/dev/null
else source "$_bash_it_config_file"
echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr else
fi echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr
done fi
done ;;
esac
fi fi
unset _bash_it_config_file unset _bash_it_config_file