mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
fix: use recommended way of updating Fish shell $PATH
fixes https://github.com/Homebrew/brew/issues/8965 See Fish docs https://fishshell.com/docs/current/tutorial.html#path. > A faster way is to use the `fish_add_path function`... The advantage is that > you don't have to go mucking around in files: just run this once at the > command line, and it will affect the current session and all future instances > too. > > Or you can modify `$fish_user_paths` yourself, but you should be careful not > to append to it unconditionally in config.fish, or it will grow longer and > longer.
This commit is contained in:
parent
64b6846d60
commit
7920006020
@ -98,7 +98,7 @@ describe Utils::Shell do
|
|||||||
ENV["SHELL"] = "/usr/local/bin/fish"
|
ENV["SHELL"] = "/usr/local/bin/fish"
|
||||||
ENV["fish_user_paths"] = "/some/path"
|
ENV["fish_user_paths"] = "/some/path"
|
||||||
expect(described_class.prepend_path_in_profile(path))
|
expect(described_class.prepend_path_in_profile(path))
|
||||||
.to eq("echo 'set -g fish_user_paths \"#{path}\" $fish_user_paths' >> #{shell_profile}")
|
.to eq("echo 'fish_add_path #{path}' >> #{shell_profile}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -78,7 +78,7 @@ module Utils
|
|||||||
when :csh, :tcsh
|
when :csh, :tcsh
|
||||||
"echo 'setenv PATH #{csh_quote(path)}:$PATH' >> #{profile}"
|
"echo 'setenv PATH #{csh_quote(path)}:$PATH' >> #{profile}"
|
||||||
when :fish
|
when :fish
|
||||||
"echo 'set -g fish_user_paths \"#{sh_quote(path)}\" $fish_user_paths' >> #{profile}"
|
"echo 'fish_add_path #{sh_quote(path)}' >> #{profile}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user