Skip to content

Commit 5368015

Browse files
jeffbyrnesmathiasbynens
authored andcommitted
.bash_profile: Update bash-completion sourcing (mathiasbynens#864)
The previous sourcing is replaced with what the current “caveats” specify (see `brew info bash-completion@2`). And, thanks to Homebrew/homebrew-core#36254, any bash-completions meant for bash-completion v1 are now included, thanks to the environment variable.
1 parent 307c635 commit 5368015

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.bash_profile

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ for option in autocd globstar; do
2626
done;
2727

2828
# Add tab completion for many Bash commands
29-
if which brew &> /dev/null && [ -f "$(brew --prefix)/share/bash-completion/bash_completion" ]; then
30-
source "$(brew --prefix)/share/bash-completion/bash_completion";
29+
if which brew &> /dev/null && [ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]; then
30+
# Ensure existing Homebrew v1 completions continue to work
31+
export BASH_COMPLETION_COMPAT_DIR="$(brew --prefix)/etc/bash_completion.d";
32+
source "$(brew --prefix)/etc/profile.d/bash_completion.sh";
3133
elif [ -f /etc/bash_completion ]; then
3234
source /etc/bash_completion;
3335
fi;

0 commit comments

Comments
 (0)