Skip to content

Commit

Permalink
Update Fish shell environment script
Browse files Browse the repository at this point in the history
Fish didn't support `$(...)` substitution until v3.4.0, but the command
didn't work with just parenthesis, so rewrite the test to prepend an
empty string if MANPATH is non-empty (to trigger a leading colon).
Only manipulate INFOPATH in Fish if Homebrew not in path already.
  • Loading branch information
smsearcy committed Aug 10, 2024
1 parent 102dec8 commit 1785563
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/cmd/shellenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ homebrew-shellenv() {
echo "set -gx HOMEBREW_CELLAR \"${HOMEBREW_CELLAR}\";"
echo "set -gx HOMEBREW_REPOSITORY \"${HOMEBREW_REPOSITORY}\";"
echo "fish_add_path -gP \"${HOMEBREW_PREFIX}/bin\" \"${HOMEBREW_PREFIX}/sbin\";"
echo "set -q MANPATH; and set MANPATH[1] \":\$(string trim --left --chars=\":\" \$MANPATH[1])\";"
echo "! set -q INFOPATH; and set INFOPATH ''; set -gx INFOPATH \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH;"
echo "if test -n \"\$MANPATH[1]\"; set -gx MANPATH '' \$MANPATH; end;"
echo "if not contains \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH; set -gx INFOPATH \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH; end;"
;;
csh | -csh | tcsh | -tcsh)
echo "setenv HOMEBREW_PREFIX ${HOMEBREW_PREFIX};"
Expand Down

0 comments on commit 1785563

Please sign in to comment.