mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 08:53:29 +01:00
Working?
This commit is contained in:
parent
c618538cf8
commit
4fdc3646e8
@ -1,7 +1,6 @@
|
||||
use indexmap::IndexMap;
|
||||
use nu_protocol::{Primitive, UntaggedValue, Value};
|
||||
use std::io::Write;
|
||||
use std::{ffi::OsString, fmt::Debug, fs::OpenOptions, path::PathBuf};
|
||||
use std::{ffi::OsString, fmt::Debug, path::PathBuf};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct DirectorySpecificEnvironment {
|
||||
|
11
crates/nu-cli/src/env/environment.rs
vendored
11
crates/nu-cli/src/env/environment.rs
vendored
@ -71,17 +71,6 @@ impl Environment {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn remove_env(&mut self, key: &str) {
|
||||
if let Some(Value {
|
||||
value: UntaggedValue::Row(ref mut envs),
|
||||
tag: _,
|
||||
}) = self.environment_vars
|
||||
{
|
||||
envs.entries.remove(key);
|
||||
std::env::remove_var(key);
|
||||
};
|
||||
}
|
||||
|
||||
pub fn morph<T: Conf>(&mut self, configuration: &T) {
|
||||
self.environment_vars = configuration.env();
|
||||
self.path_vars = configuration.path();
|
||||
|
23
crates/nu-cli/src/env/environment_syncer.rs
vendored
23
crates/nu-cli/src/env/environment_syncer.rs
vendored
@ -44,11 +44,6 @@ impl EnvironmentSyncer {
|
||||
pub fn sync_env_vars(&mut self, ctx: &mut Context) {
|
||||
let mut environment = self.env.lock();
|
||||
|
||||
// match environment.maintain_directory_environment() {
|
||||
// Ok(_) => {}
|
||||
// Err(e) => {panic!(e)}
|
||||
// }
|
||||
|
||||
if environment.env().is_some() {
|
||||
for (name, value) in ctx.with_host(|host| host.vars()) {
|
||||
if name != "path" && name != "PATH" {
|
||||
@ -57,22 +52,8 @@ impl EnvironmentSyncer {
|
||||
environment.add_env(&name, &value, false);
|
||||
|
||||
environment
|
||||
.direnv
|
||||
.env_vars_to_add()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.for_each(|(k, v)| {
|
||||
environment.add_env(&k, &v, true);
|
||||
});
|
||||
|
||||
environment
|
||||
.direnv
|
||||
.overwritten_values_to_restore()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.for_each(|(k, v)| {
|
||||
environment.add_env(&k, &v, true);
|
||||
});
|
||||
.maintain_directory_environment()
|
||||
.expect("Could not set directory-based environment variables");
|
||||
|
||||
// clear the env var from the session
|
||||
// we are about to replace them
|
||||
|
Loading…
Reference in New Issue
Block a user