completion/system: prefer direct invocation

Instead of using the profile.d version, just invoke the script. The profile.d script preemptively short-circuits if it thinks that bash-completions has already been loaded, which it does by using the $BASH_COMPLETION variable, which is expressly supported by upstream to specify the location of the script...so it will entirely be never loaded if this is set.
pull/1908/head
John D Pell 2021-07-26 13:04:53 -07:00
parent 9ea290a5ed
commit 43947e2cbc
1 changed files with 3 additions and 3 deletions

View File

@ -14,12 +14,12 @@ elif [[ -r /etc/profile.d/bash_completion.sh ]] ; then
fi fi
if [[ "$(uname -s)" == 'Darwin' ]] && _command_exists brew ; then if [[ $OSTYPE == 'darwin'* ]] && _command_exists brew ; then
BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)} BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)}
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path # homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
if [[ -r "$BREW_PREFIX"/etc/profile.d/bash_completion.sh ]] ; then if [[ -r "$BREW_PREFIX"/etc/bash_completion ]] ; then
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$BREW_PREFIX"/etc/profile.d/bash_completion.sh source "$BREW_PREFIX"/etc/bash_completion
fi fi
fi fi