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,8 +32,9 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then
done
fi
if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${2}/enabled" ]; then
if [ -n "${2}" ] && [ -d "${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
@ -44,7 +45,8 @@ if [ ! -z "${2}" ] && [[ "${2}" =~ ^(aliases|completion|plugins)$ ]] && [ -d "${
else
echo "Unable to locate ${_bash_it_config_file}" > /dev/stderr
fi
done
done ;;
esac
fi
unset _bash_it_config_file