Skip to content

Commit 38a32d3

Browse files
committed
Correct Nushell source command
1 parent f9edccd commit 38a32d3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: src/cli/self_update.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,9 @@ macro_rules! post_install_msg_unix_source_env {
382382
the corresponding `env` file under {cargo_home}.
383383
384384
This is usually done by running one of the following (note the leading DOT):
385-
. "{cargo_home}/env" # For sh/bash/zsh/ash/dash/pdksh
386-
source "{cargo_home}/env.fish" # For fish
387-
source "{cargo_home}/env.nu" # For nushell
385+
. "{cargo_home}/env" # For sh/bash/zsh/ash/dash/pdksh
386+
source "{cargo_home}/env.fish" # For fish
387+
source $"($nu.home-path)/.cargo/env.nu" # For nushell
388388
"#
389389
};
390390
}

Diff for: src/cli/self_update/shell.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
use std::borrow::Cow;
2727
use std::path::PathBuf;
2828

29-
use anyhow::{Result, bail};
29+
use anyhow::{bail, Result};
3030

3131
use super::utils;
3232
use crate::process::Process;
@@ -299,7 +299,8 @@ impl UnixShell for Nu {
299299
}
300300

301301
fn source_string(&self, process: &Process) -> Result<String> {
302-
Ok(format!(r#"source "{}/env.nu""#, cargo_home_str(process)?))
302+
let cargo_home_nushell = (cargo_home_str(process)?).replace("$HOME", "($nu.home-path)");
303+
Ok(format!(r#"source $"{}/env.nu""#, cargo_home_nushell))
303304
}
304305
}
305306

0 commit comments

Comments
 (0)