mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
docs/Shell-Completion: read both types of bash completions.
And guard against either of them being missing. Fixes #5610
This commit is contained in:
parent
5866c2b00a
commit
f8c574bbc0
@ -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!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user