Skip to content

Commit 0cc274e

Browse files
WaffleLapkinrami3l
authored andcommitted
Write a custom env script for fish
1 parent 6838d76 commit 0cc274e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/cli/self_update/env.fish

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# rustup shell setup
2+
if not contains "{cargo_bin}" $PATH
3+
# Prepending path in case a system-installed rustc needs to be overridden
4+
set -x PATH "{cargo_bin}" $PATH
5+
end

src/cli/self_update/shell.rs

+11
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,17 @@ impl UnixShell for Fish {
235235
fn update_rcs(&self) -> Vec<PathBuf> {
236236
self.rcfiles()
237237
}
238+
239+
fn env_script(&self) -> ShellScript {
240+
ShellScript {
241+
name: "env.fish",
242+
content: include_str!("env.fish"),
243+
}
244+
}
245+
246+
fn source_string(&self) -> Result<String> {
247+
Ok(format!(r#". "{}/env.fish""#, cargo_home_str()?))
248+
}
238249
}
239250

240251
pub(crate) fn legacy_paths() -> impl Iterator<Item = PathBuf> {

0 commit comments

Comments
 (0)