mirror of
https://github.com/nushell/nushell.git
synced 2025-04-24 13:18:18 +02:00
Deletion almost works
This commit is contained in:
parent
6a0b4d1122
commit
28f01e92b7
20
crates/nu-cli/src/env/environment.rs
vendored
20
crates/nu-cli/src/env/environment.rs
vendored
@ -64,12 +64,12 @@ impl Environment {
|
|||||||
self.remove_env(&k);
|
self.remove_env(&k);
|
||||||
});
|
});
|
||||||
|
|
||||||
// self.direnv
|
self.direnv
|
||||||
// .overwritten_values_to_restore()?
|
.overwritten_values_to_restore()?
|
||||||
// .iter()
|
.iter()
|
||||||
// .for_each(|(k, v)| {
|
.for_each(|(k, v)| {
|
||||||
// self.add_env(&k, &v.to_string_lossy(), true);
|
self.add_env(&k, &v.to_string_lossy(), true);
|
||||||
// });
|
});
|
||||||
|
|
||||||
self.direnv.env_vars_to_add()?.iter().for_each(|(k, v)| {
|
self.direnv.env_vars_to_add()?.iter().for_each(|(k, v)| {
|
||||||
self.add_env(&k, &v.to_string_lossy(), true);
|
self.add_env(&k, &v.to_string_lossy(), true);
|
||||||
@ -85,14 +85,6 @@ impl Environment {
|
|||||||
}) = self.environment_vars
|
}) = self.environment_vars
|
||||||
{
|
{
|
||||||
|
|
||||||
let mut file = OpenOptions::new()
|
|
||||||
.write(true)
|
|
||||||
.append(true)
|
|
||||||
.create(true)
|
|
||||||
.open("delete.txt")
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
write!(&mut file, "deleting: {:?}\n", key).unwrap();
|
|
||||||
envs.entries.remove(key);
|
envs.entries.remove(key);
|
||||||
std::env::remove_var(key);
|
std::env::remove_var(key);
|
||||||
};
|
};
|
||||||
|
2
crates/nu-cli/src/env/environment_syncer.rs
vendored
2
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) {
|
pub fn sync_env_vars(&mut self, ctx: &mut Context) {
|
||||||
let mut environment = self.env.lock();
|
let mut environment = self.env.lock();
|
||||||
|
|
||||||
|
environment.maintain_directory_environment().ok();
|
||||||
if environment.env().is_some() {
|
if environment.env().is_some() {
|
||||||
for (name, value) in ctx.with_host(|host| host.vars()) {
|
for (name, value) in ctx.with_host(|host| host.vars()) {
|
||||||
if name != "path" && name != "PATH" {
|
if name != "path" && name != "PATH" {
|
||||||
@ -51,7 +52,6 @@ impl EnvironmentSyncer {
|
|||||||
// that aren't loaded from config.
|
// that aren't loaded from config.
|
||||||
environment.add_env(&name, &value, false);
|
environment.add_env(&name, &value, false);
|
||||||
|
|
||||||
environment.maintain_directory_environment().ok();
|
|
||||||
|
|
||||||
// clear the env var from the session
|
// clear the env var from the session
|
||||||
// we are about to replace them
|
// we are about to replace them
|
||||||
|
Loading…
Reference in New Issue
Block a user