lib/utilities: use `_bash-it-grep`

Alsö, lose a spurious `cat`
pull/1933/head
John D Pell 2021-09-11 23:54:59 -07:00
parent 22ea7d34bc
commit 0a3a019047
1 changed files with 6 additions and 6 deletions

View File

@ -78,7 +78,7 @@ _bash-it-component-help() {
if [[ ! -s "${file}" || -z "$(find "${file}" -mmin -300)" ]] ; then
rm -f "${file}" 2>/dev/null
local func="_bash-it-${component}"
"${func}" | $(_bash-it-grep) -E ' \[' | cat > "${file}"
"${func}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E ' \[' > "${file}"
fi
cat "${file}"
}
@ -124,17 +124,17 @@ _bash-it-component-list() {
_bash-it-component-list-matching() {
local component="$1"; shift
local term="$1"
_bash-it-component-help "${component}" | $(_bash-it-grep) -E -- "${term}" | awk '{print $1}' | sort -u
_bash-it-component-help "${component}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E -- "${term}" | awk '{print $1}' | sort -u
}
_bash-it-component-list-enabled() {
local IFS=$'\n' component="$1"
_bash-it-component-help "${component}" | $(_bash-it-grep) -E '\[x\]' | awk '{print $1}' | sort -u
_bash-it-component-help "${component}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E '\[x\]' | awk '{print $1}' | sort -u
}
_bash-it-component-list-disabled() {
local IFS=$'\n' component="$1"
_bash-it-component-help "${component}" | $(_bash-it-grep) -E -v '\[x\]' | awk '{print $1}' | sort -u
_bash-it-component-help "${component}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E -v '\[x\]' | awk '{print $1}' | sort -u
}
# Checks if a given item is enabled for a particular component/file-type.
@ -148,7 +148,7 @@ _bash-it-component-list-disabled() {
_bash-it-component-item-is-enabled() {
local component="$1"
local item="$2"
_bash-it-component-help "${component}" | $(_bash-it-grep) -E '\[x\]' | $(_bash-it-grep) -E -q -- "^${item}\s"
_bash-it-component-help "${component}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E '\[x\]' | ${BASH_IT_GREP:-$(_bash-it-grep)} -E -q -- "^${item}\s"
}
# Checks if a given item is disabled for a particular component/file-type.
@ -162,5 +162,5 @@ _bash-it-component-item-is-enabled() {
_bash-it-component-item-is-disabled() {
local component="$1"
local item="$2"
_bash-it-component-help "${component}" | $(_bash-it-grep) -E -v '\[x\]' | $(_bash-it-grep) -E -q -- "^${item}\s"
_bash-it-component-help "${component}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E -v '\[x\]' | ${BASH_IT_GREP:-$(_bash-it-grep)} -E -q -- "^${item}\s"
}