feat: add fish support to shell installers #958
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for fish as a shell. Like with sh, I took inspiration from rustup's implementation. This broadly leans on the existing shell support, but has a few distinct features.
~/.bashrc
, we write to a file in fish'sconf.d
path. This is a directory which is autoloaded on shell boot, which means we can create an app-specific path and can avoid having to edit the user's own configuration file.conf.d
may not exist at the time we want to interact with it, I've added anmkdir -p
call.fish_add_path
helper, which encapsulates the logic of "only prepend to the path if it's not already on thePATH
" without us having to write it ourselves. (Note thatfish_add_path
was introduced in fish 3.2.0, which was released in 2020. Since that version is available in the current LTS release of Ubuntu and Debian stable, I believe it's old enough to be safe for us to use it.)source
or.
statements. (fish strongly preferssource
and has stated.
may be removed in the future.)I gave this a test locally; it appears to be working fine, and, like with the sh side, doesn't overwrite cargo's configuration for
CargoHome
installs.