mirror of
https://github.com/nushell/nushell.git
synced 2024-12-26 17:09:06 +01:00
Add add_nurc to sync_env command
This commit is contained in:
parent
3d15ac076c
commit
8eaaddca8f
13
crates/nu-cli/src/env/environment.rs
vendored
13
crates/nu-cli/src/env/environment.rs
vendored
@ -40,26 +40,23 @@ pub struct Environment {
|
||||
|
||||
impl Environment {
|
||||
pub fn new() -> Environment {
|
||||
let mut e = Environment {
|
||||
Environment {
|
||||
environment_vars: None,
|
||||
path_vars: None,
|
||||
};
|
||||
e.add_nurc();
|
||||
e
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_config<T: Conf>(configuration: &T) -> Environment {
|
||||
let env = configuration.env();
|
||||
let path = configuration.path();
|
||||
|
||||
let mut e = Environment {
|
||||
Environment {
|
||||
environment_vars: env,
|
||||
path_vars: path,
|
||||
};
|
||||
e.add_nurc();
|
||||
e
|
||||
}
|
||||
}
|
||||
|
||||
//Add env vars specified in the current dirs .nurc, if it exists.
|
||||
pub fn add_nurc(&mut self) {
|
||||
let key = "envtest";
|
||||
let value = "I am here!";
|
||||
|
3
crates/nu-cli/src/env/environment_syncer.rs
vendored
3
crates/nu-cli/src/env/environment_syncer.rs
vendored
@ -44,6 +44,7 @@ impl EnvironmentSyncer {
|
||||
pub fn sync_env_vars(&mut self, ctx: &mut Context) {
|
||||
let mut environment = self.env.lock();
|
||||
|
||||
environment.add_nurc();
|
||||
if environment.env().is_some() {
|
||||
for (name, value) in ctx.with_host(|host| host.vars()) {
|
||||
if name != "path" && name != "PATH" {
|
||||
@ -70,8 +71,6 @@ impl EnvironmentSyncer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
environment.add_nurc();
|
||||
}
|
||||
|
||||
pub fn sync_path_vars(&mut self, ctx: &mut Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user