lib/utilities: autonomize `_bash-it-component-item-is-enabled()`
parent
22b290b94f
commit
62b5297dc2
|
|
@ -168,12 +168,18 @@ function _bash-it-component-list-disabled() {
|
||||||
# Examples:
|
# Examples:
|
||||||
# _bash-it-component-item-is-enabled alias git && echo "git alias is enabled"
|
# _bash-it-component-item-is-enabled alias git && echo "git alias is enabled"
|
||||||
function _bash-it-component-item-is-enabled() {
|
function _bash-it-component-item-is-enabled() {
|
||||||
local component="$1" item="$2"
|
local component_type item_name each_file
|
||||||
local each_file
|
|
||||||
|
|
||||||
for each_file in "${BASH_IT}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item}.${component}"*."bash" \
|
if [[ -f "${1}" ]]; then
|
||||||
"${BASH_IT}/${component}"*/"enabled/${item}.${component}"*."bash" \
|
item_name="$(_bash-it-get-component-name-from-path "${1}")"
|
||||||
"${BASH_IT}/${component}"*/"enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item}.${component}"*."bash"; do
|
component_type="$(_bash-it-get-component-type-from-path "${1}")"
|
||||||
|
else
|
||||||
|
component_type="${1}" item_name="${2}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for each_file in "${BASH_IT}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash" \
|
||||||
|
"${BASH_IT}/${component_type}"*/"enabled/${item_name}.${component_type}"*."bash" \
|
||||||
|
"${BASH_IT}/${component_type}"*/"enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${item_name}.${component_type}"*."bash"; do
|
||||||
[[ -f "${each_file}" ]] && return
|
[[ -f "${each_file}" ]] && return
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue