lib/helpers: handle unbound parameters

pull/2061/head
John D Pell 2022-02-17 20:46:28 -08:00
parent 31751624c0
commit 35ecc260c2
1 changed files with 7 additions and 5 deletions

View File

@ -542,7 +542,7 @@ function _bash-it-profile-save() {
fi fi
done done
done done
if [[ -z "$something_exists" ]]; then if [[ -z "${something_exists:-}" ]]; then
echo "It seems like no configuration was enabled.." echo "It seems like no configuration was enabled.."
echo "Make sure to double check that this is the wanted behavior." echo "Make sure to double check that this is the wanted behavior."
fi fi
@ -705,7 +705,9 @@ function _on-disable-callback() {
_group 'lib' _group 'lib'
local callback="${1}_on_disable" local callback="${1}_on_disable"
_command_exists "$callback" && "$callback" if _command_exists "$callback"; then
"$callback"
fi
} }
function _disable-all() { function _disable-all() {
@ -725,7 +727,7 @@ function _disable-plugin() {
_group 'lib' _group 'lib'
_disable-thing "plugins" "plugin" "${1?}" _disable-thing "plugins" "plugin" "${1?}"
_on-disable-callback "$1" _on-disable-callback "${1?}"
} }
function _disable-alias() { function _disable-alias() {
@ -777,7 +779,7 @@ function _disable-thing() {
# Either one will be matched by this glob # Either one will be matched by this glob
for plugin in "${BASH_IT}/enabled"/[[:digit:]][[:digit:]][[:digit:]]"${BASH_IT_LOAD_PRIORITY_SEPARATOR}${file_entity}.${suffix}.bash" "${BASH_IT}/$subdirectory/enabled/"{[[:digit:]][[:digit:]][[:digit:]]"${BASH_IT_LOAD_PRIORITY_SEPARATOR}${file_entity}.${suffix}.bash","${file_entity}.${suffix}.bash"}; do for plugin in "${BASH_IT}/enabled"/[[:digit:]][[:digit:]][[:digit:]]"${BASH_IT_LOAD_PRIORITY_SEPARATOR}${file_entity}.${suffix}.bash" "${BASH_IT}/$subdirectory/enabled/"{[[:digit:]][[:digit:]][[:digit:]]"${BASH_IT_LOAD_PRIORITY_SEPARATOR}${file_entity}.${suffix}.bash","${file_entity}.${suffix}.bash"}; do
if [[ -e "${plugin}" ]]; then if [[ -e "${plugin}" ]]; then
rm "${plugin}" rm -f "${plugin}"
plugin= plugin=
break break
fi fi
@ -790,7 +792,7 @@ function _disable-thing() {
_bash-it-clean-component-cache "${file_type}" _bash-it-clean-component-cache "${file_type}"
if [[ "$file_entity" = "all" ]]; then if [[ "$file_entity" == "all" ]]; then
_bash-it-component-pluralize "$file_type" file_type _bash-it-component-pluralize "$file_type" file_type
printf '%s\n' "$file_entity ${file_type} disabled." printf '%s\n' "$file_entity ${file_type} disabled."
else else