docs/Shell-Completion: read both types of bash completions.

And guard against either of them being missing.

Fixes #5610
This commit is contained in:
Mike McQuaid 2019-01-28 16:36:06 +00:00
parent 5866c2b00a
commit f8c574bbc0
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -12,13 +12,19 @@ To make Homebrew's completions available in `bash`, you must source the definiti
```sh ```sh
if type brew 2&>/dev/null; then if type brew 2&>/dev/null; then
source "$(brew --prefix)/etc/bash_completion.d/*" for COMPLETION in $(brew --prefix)/etc/bash_completion.d/*
else do
echo "run: brew install git bash-completion" [[ -f $COMPLETION ]] && source "$COMPLETION"
done
if [[ -f $(brew --prefix)/etc/profile.d/bash_completion.sh ]];
then
source "$(brew --prefix)/etc/profile.d/bash_completion.sh"
fi
fi fi
``` ```
## Configuring Completions in `zsh` ## Configuring Completions in `zsh`
To make Homebrew's completions available in `zsh`, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising `zsh`'s completion facility. Add the following to your `~/.zshrc` file: To make Homebrew's completions available in `zsh`, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising `zsh`'s completion facility. Add the following to your `~/.zshrc` file:
```sh ```sh
@ -42,4 +48,5 @@ Additionally, if you receive "zsh compinit: insecure directories" warnings when
``` ```
## Configuring Completions in `fish` ## Configuring Completions in `fish`
No configuration is needed in `fish`. Friendly! No configuration is needed in `fish`. Friendly!