Skip to content

Commit

Permalink
Write a custom env script for fish
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin authored and rami3l committed Oct 9, 2023
1 parent 6838d76 commit 0cc274e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli/self_update/env.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# rustup shell setup
if not contains "{cargo_bin}" $PATH
# Prepending path in case a system-installed rustc needs to be overridden
set -x PATH "{cargo_bin}" $PATH
end
11 changes: 11 additions & 0 deletions src/cli/self_update/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ impl UnixShell for Fish {
fn update_rcs(&self) -> Vec<PathBuf> {
self.rcfiles()
}

fn env_script(&self) -> ShellScript {
ShellScript {
name: "env.fish",
content: include_str!("env.fish"),
}
}

fn source_string(&self) -> Result<String> {
Ok(format!(r#". "{}/env.fish""#, cargo_home_str()?))
}
}

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

0 comments on commit 0cc274e

Please sign in to comment.