From a573d8f35b224e1080db90cd4ffc9c960d64e23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20B=C3=BCckendorf?= Date: Mon, 20 Feb 2023 11:31:44 +0100 Subject: [PATCH] fix(brew): do not assume brew install path --- .bashrc.d/brew_caveats.sh | 14 +++++++++----- .bashrc.d/dotfiles_command.sh | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.bashrc.d/brew_caveats.sh b/.bashrc.d/brew_caveats.sh index 8734236..1c890a6 100644 --- a/.bashrc.d/brew_caveats.sh +++ b/.bashrc.d/brew_caveats.sh @@ -1,13 +1,17 @@ # Save other operating systems some work -if [[ $OSTYPE != darwin* ]]; then +if [[ $OSTYPE != darwin* ]] || ! command -v brew >/dev/null 2>&1; then return fi +BREW_DIR=$(brew --prefix) + # for brew formula bash-completion@2 -if [[ -r /usr/local/etc/profile.d/bash_completion.sh ]]; then - export BASH_COMPLETION_COMPAT_DIR=/usr/local/etc/bash_completion.d - . /usr/local/etc/profile.d/bash_completion.sh +if [[ -r ${BREW_DIR}/etc/profile.d/bash_completion.sh ]]; then + export BASH_COMPLETION_COMPAT_DIR=${BREW_DIR}/etc/bash_completion.d + . ${BREW_DIR}/etc/profile.d/bash_completion.sh fi # for brew formula python -export PATH=/usr/local/opt/python/libexec/bin:$PATH +if [[ -d ${BREW_DIR}/opt/python/libexec/bin ]]; then + export PATH=${BREW_DIR}/opt/python/libexec/bin:$PATH +fi diff --git a/.bashrc.d/dotfiles_command.sh b/.bashrc.d/dotfiles_command.sh index f7da2b0..b4f3c69 100644 --- a/.bashrc.d/dotfiles_command.sh +++ b/.bashrc.d/dotfiles_command.sh @@ -18,6 +18,7 @@ possible_locations=( "/usr/share/git/completion/git-completion.bash" "/usr/share/bash-completion/completions/git" "/usr/local/etc/bash_completion.d/git-completion.bash" + "/opt/homebrew/etc/bash_completion.d/git-completion.bash" ) for completion_file in "${possible_locations[@]}"