Skip to content

Commit

Permalink
Fix nushell environment variable assignment (#148)
Browse files Browse the repository at this point in the history
Nushell has a new way of defining environment variables
and deprecated the old way of using let-env. Now you just
mutate the $env variable.
  • Loading branch information
arseeeeN committed Aug 6, 2023
1 parent 95816dd commit 4709849
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shell/nu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn spawn_shell(info: &ShellSpawnInfo) -> Result<()> {

for (name, value) in &info.env_vars.vars {
args.push_str(&format!(
r#"let-env {} = '{}';"#,
r#"$env.{} = '{}';"#,
name,
value.as_os_str().to_str().unwrap()
));
Expand All @@ -25,7 +25,7 @@ pub fn spawn_shell(info: &ShellSpawnInfo) -> Result<()> {
.replace("\\[\\e[0m\\]", "")
.replace('$', "");
let prompt = format!(
r#"let-env PROMPT_COMMAND = {{ || $"{prompt}\n(create_left_prompt)" }};"#,
r#"$env.PROMPT_COMMAND = {{ || $"{prompt}\n(create_left_prompt)" }};"#,
prompt = _prompt
);
args.push_str(prompt.as_str());
Expand Down

0 comments on commit 4709849

Please sign in to comment.