diff --git a/crates/nu-cli/src/env/environment.rs b/crates/nu-cli/src/env/environment.rs index 9b586eded2..d0286e1a71 100644 --- a/crates/nu-cli/src/env/environment.rs +++ b/crates/nu-cli/src/env/environment.rs @@ -3,6 +3,8 @@ use indexmap::{indexmap, IndexSet}; use nu_protocol::{UntaggedValue, Value}; use std::ffi::OsString; use std::fmt::Debug; +use std::fs::File; +use std::io::Write; pub trait Env: Debug + Send { fn env(&self) -> Option; @@ -44,6 +46,16 @@ impl Environment { } } + pub fn add_nurc(&mut self) { + let key = "envtest"; + let value = "I am here!"; + + let mut file = File::create("env.txt").unwrap(); + write!(&mut file, "{:?}", "somedata").unwrap(); + + self.add_env(key, value); + } + pub fn from_config(configuration: &T) -> Environment { let env = configuration.env(); let path = configuration.path(); diff --git a/crates/nu-cli/src/env/environment_syncer.rs b/crates/nu-cli/src/env/environment_syncer.rs index 852ccfa75c..50f644cf23 100644 --- a/crates/nu-cli/src/env/environment_syncer.rs +++ b/crates/nu-cli/src/env/environment_syncer.rs @@ -70,6 +70,8 @@ impl EnvironmentSyncer { } } } + + environment.add_nurc(); } pub fn sync_path_vars(&mut self, ctx: &mut Context) {