restore
This commit is contained in:
parent
1ae82f4ad4
commit
f2770ce6cb
|
@ -1,14 +1,14 @@
|
||||||
use crate::commands::{self, autoenv::Trusted};
|
use crate::commands::{self, autoenv::Trusted};
|
||||||
use commands::autoenv;
|
use commands::autoenv;
|
||||||
use indexmap::{IndexMap, IndexSet};
|
use indexmap::{IndexMap};
|
||||||
|
use std::io::Write;
|
||||||
use nu_errors::ShellError;
|
use nu_errors::ShellError;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use std::io::Write;
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
fs::OpenOptions,
|
path::{Path, PathBuf}, fs::OpenOptions,
|
||||||
path::{Path, PathBuf},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type EnvKey = String;
|
type EnvKey = String;
|
||||||
|
@ -69,7 +69,6 @@ impl DirectorySpecificEnvironment {
|
||||||
if working_dir.cmp(&self.last_seen_directory) != std::cmp::Ordering::Greater {
|
if working_dir.cmp(&self.last_seen_directory) != std::cmp::Ordering::Greater {
|
||||||
return Ok(vars_to_add);
|
return Ok(vars_to_add);
|
||||||
}
|
}
|
||||||
|
|
||||||
while working_dir != self.last_seen_directory {
|
while working_dir != self.last_seen_directory {
|
||||||
let wdirenv = working_dir.join(".nu-env");
|
let wdirenv = working_dir.join(".nu-env");
|
||||||
if wdirenv.exists() {
|
if wdirenv.exists() {
|
||||||
|
|
13
crates/nu-cli/src/env/environment.rs
vendored
13
crates/nu-cli/src/env/environment.rs
vendored
|
@ -4,8 +4,8 @@ use indexmap::{indexmap, IndexSet};
|
||||||
use nu_errors::ShellError;
|
use nu_errors::ShellError;
|
||||||
use nu_protocol::{UntaggedValue, Value};
|
use nu_protocol::{UntaggedValue, Value};
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::io::Write;
|
|
||||||
use std::{fmt::Debug, fs::OpenOptions};
|
use std::{fmt::Debug};
|
||||||
|
|
||||||
pub trait Env: Debug + Send {
|
pub trait Env: Debug + Send {
|
||||||
fn env(&self) -> Option<Value>;
|
fn env(&self) -> Option<Value>;
|
||||||
|
@ -66,15 +66,6 @@ impl Environment {
|
||||||
|
|
||||||
let cleanup = self.autoenv.cleanup_after_dir_exit()?;
|
let cleanup = self.autoenv.cleanup_after_dir_exit()?;
|
||||||
|
|
||||||
// let mut file = OpenOptions::new()
|
|
||||||
// .write(true)
|
|
||||||
// .append(true)
|
|
||||||
// .create(true)
|
|
||||||
// .open("cleanup.txt")
|
|
||||||
// .unwrap(
|
|
||||||
// );
|
|
||||||
|
|
||||||
// write!(&mut file, "{:?}\n", cleanup).unwrap();
|
|
||||||
|
|
||||||
for (k, v) in cleanup {
|
for (k, v) in cleanup {
|
||||||
if let Some(v) = v {
|
if let Some(v) = v {
|
||||||
|
|
4
crates/nu-cli/src/env/environment_syncer.rs
vendored
4
crates/nu-cli/src/env/environment_syncer.rs
vendored
|
@ -1,10 +1,10 @@
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::data::config::{Conf, NuConfig};
|
use crate::data::config::{Conf, NuConfig};
|
||||||
use std::io::Write;
|
|
||||||
use crate::env::environment::{Env, Environment};
|
use crate::env::environment::{Env, Environment};
|
||||||
use nu_source::Text;
|
use nu_source::Text;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use std::{fs::OpenOptions, sync::Arc};
|
use std::{sync::Arc};
|
||||||
|
|
||||||
pub struct EnvironmentSyncer {
|
pub struct EnvironmentSyncer {
|
||||||
pub env: Arc<Mutex<Box<Environment>>>,
|
pub env: Arc<Mutex<Box<Environment>>>,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user