lib/utilities: `_bash-it-component-help()`

No need to `rm` when we overwrite the file the line after next. Alsö, use `>|` in case the user sets `noclobber`; we do expressly intend to overwrite the file in this case.
pull/1973/head
John D Pell 2021-10-07 22:43:48 -07:00
parent f7cc442af4
commit 7cd02781f8
1 changed files with 1 additions and 2 deletions

View File

@ -75,9 +75,8 @@ function _bash-it-component-help() {
component="$(_bash-it-pluralize-component "${1}")" component="$(_bash-it-pluralize-component "${1}")"
file="$(_bash-it-component-cache-file "${component}")" file="$(_bash-it-component-cache-file "${component}")"
if [[ ! -s "${file}" || -z "$(find "${file}" -mmin -300)" ]]; then if [[ ! -s "${file}" || -z "$(find "${file}" -mmin -300)" ]]; then
rm -f "${file}" 2> /dev/null
func="_bash-it-${component}" func="_bash-it-${component}"
"${func}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E ' \[' > "${file}" "${func}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E ' \[' >| "${file}"
fi fi
cat "${file}" cat "${file}"
} }