mirror of
https://github.com/nushell/nushell.git
synced 2025-08-03 15:58:20 +02:00
* Add args in .nurc file to environment * Working dummy version * Add add_nurc to sync_env command * Parse .nurc file * Delete env vars after leaving directory * Removing vals not working, strangely * Refactoring, add comment * Debugging * Debug by logging to file * Add and remove env var behavior appears correct However, it does not use existing code that well. * Move work to cli.rs * Parse config directories * I am in a state of distress * Rename .nurc to .nu * Some notes for me * Refactoring * Removing vars works, but not done in a very nice fashion * Refactor env_vars_to_delete * Refactor env_vars_to_add() * Move directory environment code to separate file * Refactor from_config * Restore env values * Working? * Working? * Update comments and change var name * Formatting * Remove vars after leaving dir * Remove notes I made * Rename config function * Clippy * Cleanup and handle errors * cargo fmt * Better error messages, remove last (?) unwrap * FORMAT PLZ * Rename whitelisted_directories to allowed_directories * Add comment to clarify how overwritten values are restored.
28 lines
526 B
Rust
28 lines
526 B
Rust
use nu_protocol::Value;
|
|
use std::fmt::Debug;
|
|
|
|
pub trait Conf: Debug + Send {
|
|
fn env(&self) -> Option<Value>;
|
|
fn path(&self) -> Option<Value>;
|
|
fn nu_env_dirs(&self) -> Option<Value>;
|
|
fn reload(&self);
|
|
}
|
|
|
|
impl Conf for Box<dyn Conf> {
|
|
fn env(&self) -> Option<Value> {
|
|
(**self).env()
|
|
}
|
|
|
|
fn nu_env_dirs(&self) -> Option<Value> {
|
|
(**self).nu_env_dirs()
|
|
}
|
|
|
|
fn path(&self) -> Option<Value> {
|
|
(**self).path()
|
|
}
|
|
|
|
fn reload(&self) {
|
|
(**self).reload();
|
|
}
|
|
}
|