From b9bbf0c10f9d4d2d1ad3356a99280388b4fce2a0 Mon Sep 17 00:00:00 2001 From: pwygab <88221256+merelymyself@users.noreply.github.com> Date: Tue, 12 Jul 2022 19:05:19 +0800 Subject: [PATCH] make auto-cd change `$env.OLDPWD` (#6019) * make auto-cd change `$env.OLDPWD` * fmt * use Config * make auto-cd change `.OLDPWD` --- crates/nu-cli/src/repl.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index 1c5dfb0529..536808a9cc 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -349,6 +349,14 @@ pub fn evaluate_repl( (path.to_string_lossy().to_string(), tokens.0[0].span) }; + stack.add_env_var( + "OLDPWD".into(), + Value::String { + val: cwd.clone(), + span: Span { start: 0, end: 0 }, + }, + ); + //FIXME: this only changes the current scope, but instead this environment variable //should probably be a block that loads the information from the state in the overlay stack.add_env_var(