From 9dce7a951efaabccdf0fa5be87cd1b92a4c75dbd Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 20:19:44 +0000 Subject: [PATCH] fix: source completions even if not brew user --- .../usr/etc/profile.d/brew-bash-completion.sh | 16 ++++++++-------- system_files/shared/usr/etc/zsh/zshrc | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh index 44313da193f..424ac4ad1bc 100644 --- a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh +++ b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh @@ -10,14 +10,14 @@ if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BREW_BASH_COMPLETION-}" if ! test -L /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew; then /home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null fi - if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then - for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do - if test -r "$rc"; then - . "$rc" - fi - done - unset rc - fi + fi + if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then + for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do + if test -r "$rc"; then + . "$rc" + fi + done + unset rc fi fi BREW_BASH_COMPLETION=1 diff --git a/system_files/shared/usr/etc/zsh/zshrc b/system_files/shared/usr/etc/zsh/zshrc index 2e9531018a2..89da0d7c1c8 100644 --- a/system_files/shared/usr/etc/zsh/zshrc +++ b/system_files/shared/usr/etc/zsh/zshrc @@ -16,13 +16,13 @@ # Brew needs to be loaded before compinit is called if [[ -o interactive ]] && [[ -d /home/linuxbrew/.linuxbrew ]]; then eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - if [[ -w /home/linuxbrew/.linuxbrew ]]; then - if type brew &>/dev/null; then + if type brew &>/dev/null; then + if [[ -w /home/linuxbrew/.linuxbrew ]]; then if [[ ! -L "$(brew --prefix)/share/zsh/site-functions/_brew" ]]; then brew completions link fi - FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" fi + FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" fi fi