mirror of
https://github.com/nushell/nushell.git
synced 2025-05-19 09:20:45 +02:00
Rename direnv to autoenv
This commit is contained in:
parent
21ebfca368
commit
4bebfa2762
@ -47,7 +47,7 @@ impl DirectorySpecificEnvironment {
|
||||
})?);
|
||||
}
|
||||
return Err(ShellError::untagged_runtime_error(
|
||||
format!("{:?} is untrusted. Run 'autoenv trust {:?}' and restart nushell to trust it.\nThis needs to be done after each change to the file.", wdirenv, wdirenv.parent().unwrap_or_else(|| &Path::new("")))));
|
||||
format!("{:?} is untrusted. Run 'autoenv trust {:?}' and restart nushell to trust it.\nThis needs to be done after each change to the file.\n", wdirenv, wdirenv.parent().unwrap_or_else(|| &Path::new("")))));
|
||||
}
|
||||
Err(ShellError::untagged_runtime_error("No trusted directories"))
|
||||
}
|
||||
|
12
crates/nu-cli/src/env/environment.rs
vendored
12
crates/nu-cli/src/env/environment.rs
vendored
@ -36,7 +36,7 @@ impl Env for Box<dyn Env> {
|
||||
pub struct Environment {
|
||||
environment_vars: Option<Value>,
|
||||
path_vars: Option<Value>,
|
||||
pub direnv: DirectorySpecificEnvironment,
|
||||
pub autoenv: DirectorySpecificEnvironment,
|
||||
}
|
||||
|
||||
impl Environment {
|
||||
@ -44,7 +44,7 @@ impl Environment {
|
||||
Environment {
|
||||
environment_vars: None,
|
||||
path_vars: None,
|
||||
direnv: DirectorySpecificEnvironment::new(),
|
||||
autoenv: DirectorySpecificEnvironment::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,16 +54,16 @@ impl Environment {
|
||||
Environment {
|
||||
environment_vars: env,
|
||||
path_vars: path,
|
||||
direnv: DirectorySpecificEnvironment::new(),
|
||||
autoenv: DirectorySpecificEnvironment::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn maintain_directory_environment(&mut self) -> Result<(), ShellError> {
|
||||
self.direnv.env_vars_to_delete()?.iter().for_each(|k| {
|
||||
pub fn autoenv(&mut self) -> Result<(), ShellError> {
|
||||
self.autoenv.env_vars_to_delete()?.iter().for_each(|k| {
|
||||
self.remove_env(&k);
|
||||
});
|
||||
|
||||
self.direnv.env_vars_to_add()?.iter().for_each(|(k, v)| {
|
||||
self.autoenv.env_vars_to_add()?.iter().for_each(|(k, v)| {
|
||||
self.add_env(&k, &v.to_string_lossy(), true);
|
||||
});
|
||||
Ok(())
|
||||
|
2
crates/nu-cli/src/env/environment_syncer.rs
vendored
2
crates/nu-cli/src/env/environment_syncer.rs
vendored
@ -45,7 +45,7 @@ impl EnvironmentSyncer {
|
||||
pub fn sync_env_vars(&mut self, ctx: &mut Context) {
|
||||
let mut environment = self.env.lock();
|
||||
|
||||
if let Err(e) = environment.maintain_directory_environment() {
|
||||
if let Err(e) = environment.autoenv() {
|
||||
crate::cli::print_err(e, &Text::from(""));
|
||||
}
|
||||
if environment.env().is_some() {
|
||||
|
Loading…
Reference in New Issue
Block a user