Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shellenv: Use fish_add_path for fish $PATH #13175

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/shellenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ homebrew-shellenv() {
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 "fish_add_path -gP \"${HOMEBREW_PREFIX}/bin\" \"${HOMEBREW_PREFIX}/sbin\";"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why global and not universal?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A universal $PATH is a bad idea (and fish_add_path doesn't allow it).

It could use the universal $fish_user_paths, but that's typically meant for, well, the user's stuff. It's also harder to remove because you now need to not just remove the fish_add_path call but also the elements from the universal. (universal variables have their issues and we're rethinking them)

Plus everything else here is global.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And e.g. if $HOMEBREW_PREFIX changes this wouldn't remove the old paths from $fish_user_paths.

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;"
;;
Expand Down