From 5368015b53467949c36f1e386582ac066b0d0ae6 Mon Sep 17 00:00:00 2001 From: Jeff Byrnes Date: Thu, 25 Apr 2019 03:42:27 -0400 Subject: [PATCH] .bash_profile: Update bash-completion sourcing (#864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .bash_profile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.bash_profile b/.bash_profile index 7334d10b9f2..f79b6145e40 100644 --- a/.bash_profile +++ b/.bash_profile @@ -26,8 +26,10 @@ for option in autocd globstar; do done; # Add tab completion for many Bash commands -if which brew &> /dev/null && [ -f "$(brew --prefix)/share/bash-completion/bash_completion" ]; then - source "$(brew --prefix)/share/bash-completion/bash_completion"; +if which brew &> /dev/null && [ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]; then + # Ensure existing Homebrew v1 completions continue to work + export BASH_COMPLETION_COMPAT_DIR="$(brew --prefix)/etc/bash_completion.d"; + source "$(brew --prefix)/etc/profile.d/bash_completion.sh"; elif [ -f /etc/bash_completion ]; then source /etc/bash_completion; fi;