From 0a3a0190470107f8b1d9155c9177d12d744f8a76 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 11 Sep 2021 23:54:59 -0700 Subject: [PATCH] lib/utilities: use `_bash-it-grep` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alsö, lose a spurious `cat` --- lib/utilities.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/utilities.bash b/lib/utilities.bash index fa77d4fd..de31810e 100644 --- a/lib/utilities.bash +++ b/lib/utilities.bash @@ -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" }