Bash completions: use HOMEBREW_CELLAR, if set

This commit is contained in:
Maxim Belkin 2023-02-11 10:59:52 -07:00
parent 1cf53b4281
commit fd5e9c8662
No known key found for this signature in database
GPG Key ID: AC71560D4C5F2338
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ __brew_complete_casks() {
__brew_complete_installed_formulae() { __brew_complete_installed_formulae() {
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
local installed_formulae local installed_formulae
installed_formulae="$(command ls "$(brew --cellar)" 2>/dev/null)" installed_formulae="$(command ls "${HOMEBREW_CELLAR:-$(brew --cellar)}" 2>/dev/null)"
while read -r line; do COMPREPLY+=("${line}"); done < <(compgen -W "${installed_formulae}" -- "${cur}") while read -r line; do COMPREPLY+=("${line}"); done < <(compgen -W "${installed_formulae}" -- "${cur}")
} }

View File

@ -46,7 +46,7 @@ __brew_complete_casks() {
__brew_complete_installed_formulae() { __brew_complete_installed_formulae() {
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
local installed_formulae local installed_formulae
installed_formulae="$(command ls "$(brew --cellar)" 2>/dev/null)" installed_formulae="$(command ls "${HOMEBREW_CELLAR:-$(brew --cellar)}" 2>/dev/null)"
while read -r line; do COMPREPLY+=("${line}"); done < <(compgen -W "${installed_formulae}" -- "${cur}") while read -r line; do COMPREPLY+=("${line}"); done < <(compgen -W "${installed_formulae}" -- "${cur}")
} }