From 67c5006b0a9747876fcaafbe44493f16ef4bf57e Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Wed, 28 Apr 2021 20:47:39 +0900 Subject: [PATCH] cmd/shellenv.sh: repair style and set HOMEBREW_CASK_REPOSITORY --- Library/Homebrew/brew.sh | 1 + Library/Homebrew/cmd/shellenv.sh | 41 +++++++++++++++++--------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 5fbb120346..d7d6f8b2f2 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -315,6 +315,7 @@ then fi HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" +HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" case "$*" in --version|-v) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"; homebrew-version; exit 0 ;; diff --git a/Library/Homebrew/cmd/shellenv.sh b/Library/Homebrew/cmd/shellenv.sh index 39327d20fc..d7f2e73972 100644 --- a/Library/Homebrew/cmd/shellenv.sh +++ b/Library/Homebrew/cmd/shellenv.sh @@ -5,31 +5,34 @@ #: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times. #: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)` +# HOMEBREW_CELLAR and HOMEBREW_PREFIX are set by extend/ENV/super.rb +# HOMEBREW_REPOSITORY is set by bin/brew +# shellcheck disable=SC2154 homebrew-shellenv() { - case "$(/bin/ps -p $PPID -c -o comm=)" in + case "$(/bin/ps -p "${PPID}" -c -o comm=)" in fish|-fish) - echo "set -gx HOMEBREW_PREFIX \"$HOMEBREW_PREFIX\";" - echo "set -gx HOMEBREW_CELLAR \"$HOMEBREW_CELLAR\";" - echo "set -gx HOMEBREW_REPOSITORY \"$HOMEBREW_REPOSITORY\";" - echo "set -q PATH; or set PATH ''; set -gx PATH \"$HOMEBREW_PREFIX/bin\" \"$HOMEBREW_PREFIX/sbin\" \$PATH;" - echo "set -q MANPATH; or set MANPATH ''; set -gx MANPATH \"$HOMEBREW_PREFIX/share/man\" \$MANPATH;" - echo "set -q INFOPATH; or set INFOPATH ''; set -gx INFOPATH \"$HOMEBREW_PREFIX/share/info\" \$INFOPATH;" + echo "set -gx HOMEBREW_PREFIX \"${HOMEBREW_PREFIX}\";" + echo "set -gx HOMEBREW_CELLAR \"${HOMEBREW_CELLAR}\";" + echo "set -gx HOMEBREW_REPOSITORY \"${HOMEBREW_REPOSITORY}\";" + echo "set -q PATH; or set PATH ''; set -gx PATH \"${HOMEBREW_PREFIX}/bin\" \"${HOMEBREW_PREFIX}/sbin\" \$PATH;" + echo "set -q MANPATH; or set MANPATH ''; set -gx MANPATH \"${HOMEBREW_PREFIX}/share/man\" \$MANPATH;" + echo "set -q INFOPATH; or set INFOPATH ''; set -gx INFOPATH \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH;" ;; csh|-csh|tcsh|-tcsh) - echo "setenv HOMEBREW_PREFIX $HOMEBREW_PREFIX;" - echo "setenv HOMEBREW_CELLAR $HOMEBREW_CELLAR;" - echo "setenv HOMEBREW_REPOSITORY $HOMEBREW_REPOSITORY;" - echo "setenv PATH $HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH;" - echo "setenv MANPATH $HOMEBREW_PREFIX/share/man\`[ \${?MANPATH} == 1 ] && echo \":\${MANPATH}\"\`:;" - echo "setenv INFOPATH $HOMEBREW_PREFIX/share/info\`[ \${?INFOPATH} == 1 ] && echo \":\${INFOPATH}\"\`;" + echo "setenv HOMEBREW_PREFIX ${HOMEBREW_PREFIX};" + echo "setenv HOMEBREW_CELLAR ${HOMEBREW_CELLAR};" + echo "setenv HOMEBREW_REPOSITORY ${HOMEBREW_REPOSITORY};" + echo "setenv PATH ${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:\$PATH;" + echo "setenv MANPATH ${HOMEBREW_PREFIX}/share/man\`[ \${?MANPATH} == 1 ] && echo \":\${MANPATH}\"\`:;" + echo "setenv INFOPATH ${HOMEBREW_PREFIX}/share/info\`[ \${?INFOPATH} == 1 ] && echo \":\${INFOPATH}\"\`;" ;; *) - echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\";" - echo "export HOMEBREW_CELLAR=\"$HOMEBREW_CELLAR\";" - echo "export HOMEBREW_REPOSITORY=\"$HOMEBREW_REPOSITORY\";" - echo "export PATH=\"$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin\${PATH+:\$PATH}\";" - echo "export MANPATH=\"$HOMEBREW_PREFIX/share/man\${MANPATH+:\$MANPATH}:\";" - echo "export INFOPATH=\"$HOMEBREW_PREFIX/share/info:\${INFOPATH:-}\";" + echo "export HOMEBREW_PREFIX=\"${HOMEBREW_PREFIX}\";" + echo "export HOMEBREW_CELLAR=\"${HOMEBREW_CELLAR}\";" + echo "export HOMEBREW_REPOSITORY=\"${HOMEBREW_REPOSITORY}\";" + echo "export PATH=\"${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin\${PATH+:\$PATH}\";" + echo "export MANPATH=\"${HOMEBREW_PREFIX}/share/man\${MANPATH+:\$MANPATH}:\";" + echo "export INFOPATH=\"${HOMEBREW_PREFIX}/share/info:\${INFOPATH:-}\";" ;; esac }