Merge pull request #6105 from mroth/patch-1

speedup bash completion loading suggestion in docs
This commit is contained in:
Mike McQuaid 2019-05-07 18:01:55 +01:00 committed by GitHub
commit 039885c95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,14 +11,15 @@ You must configure your shell to enable the completion support. This is because
To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell startup. Add the following to your `~/.bash_profile` file: To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell startup. Add the following to your `~/.bash_profile` file:
```sh ```sh
HOMEBREW_PREFIX=$(brew --prefix)
if type brew &>/dev/null; then if type brew &>/dev/null; then
for COMPLETION in $(brew --prefix)/etc/bash_completion.d/* for COMPLETION in "$HOMEBREW_PREFIX"/etc/bash_completion.d/*
do do
[[ -f $COMPLETION ]] && source "$COMPLETION" [[ -f $COMPLETION ]] && source "$COMPLETION"
done done
if [[ -f $(brew --prefix)/etc/profile.d/bash_completion.sh ]]; if [[ -f ${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh ]];
then then
source "$(brew --prefix)/etc/profile.d/bash_completion.sh" source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
fi fi
fi fi
``` ```