Skip to content

Add suggestions to mention sourcing env.fish #3506

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

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,24 +215,33 @@ but will not be added automatically."
};
}

#[cfg(not(windows))]
macro_rules! post_install_msg_unix_source_env {
() => {
r#"To configure your current shell, you need to source
the corresponding `env` file under {cargo_home}.

This is usually done by running one of the following:
source "{cargo_home}/env" # For bash/zsh
. "{cargo_home}/env" # For ash/dash/pdksh (note the leading DOT)
source "{cargo_home}/env.fish" # For fish
"#
};
}

#[cfg(not(windows))]
macro_rules! post_install_msg_unix {
() => {
r#"# Rust is installed now. Great!
concat!(
r"# Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your `PATH` environment variable to include
Cargo's bin directory ({cargo_home}/bin).

To configure your current shell, you need to source
the `env` file ({cargo_home}/env).

This is usually done by running:
source "{cargo_home}/env"

The `source` command above might need to be replaced with `.`
on shells like `ash`, `dash` and `pdksh`.
"#
",
post_install_msg_unix_source_env!(),
)
};
}

Expand All @@ -252,20 +261,15 @@ Cargo's bin directory ({cargo_home}\\bin).
#[cfg(not(windows))]
macro_rules! post_install_msg_unix_no_modify_path {
() => {
r#"# Rust is installed now. Great!
concat!(
r"# Rust is installed now. Great!

To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH`
environment variable. This has not been done automatically.

To configure your current shell, you need to source
the `env` file ({cargo_home}/env).

This is usually done by running:
source "{cargo_home}/env"

The `source` command above might need to be replaced with `.`
on shells like `ash`, `dash` and `pdksh`.
"#
",
post_install_msg_unix_source_env!(),
)
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/self_update/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl UnixShell for Fish {
fn does_exist(&self) -> bool {
// fish has to either be the shell or be callable for fish setup.
matches!(process().var("SHELL"), Ok(sh) if sh.contains("fish"))
|| matches!(utils::find_cmd(&["fish"]), Some(_))
|| utils::find_cmd(&["fish"]).is_some()
}

// > "$XDG_CONFIG_HOME/fish/conf.d" (or "~/.config/fish/conf.d" if that variable is unset) for the user
Expand Down