nushell/crates/nu-engine/src/lib.rs

41 lines
1.4 KiB
Rust
Raw Normal View History

mod call_info;
mod command_args;
mod config_holder;
pub mod documentation;
mod env;
pub mod evaluate;
pub mod evaluation_context;
mod example;
pub mod filesystem;
mod from_value;
mod maybe_text_codec;
pub mod plugin;
mod print;
pub mod script;
pub mod shell;
mod types;
mod whole_stream_command;
pub use crate::call_info::UnevaluatedCallInfo;
pub use crate::command_args::{CommandArgs, RunnableContext};
pub use crate::config_holder::ConfigHolder;
pub use crate::documentation::{generate_docs, get_brief_help, get_documentation, get_full_help};
pub use crate::env::host::FakeHost;
pub use crate::env::host::Host;
pub use crate::evaluate::block::run_block;
Allow environment variables to be hidden (#3950) * Allow environment variables to be hidden This change allows environment variables in Nushell to have a value of `Nothing`, which can be set by the user by passing `$nothing` to `let-env` and friends. Environment variables with a value of Nothing behave as if they are not set at all. This allows a user to shadow the value of an environment variable in a parent scope, effectively removing it from their current scope. This was not possible before, because a scope can not affect its parent scopes. This is a workaround for issues like #3920. Additionally, this allows a user to simultaneously set, change and remove multiple environment variables via `load-env`. Any environment variables set to $nothing will be hidden and thus act as if they are removed. This simplifies working with virtual environments, which rely on setting multiple environment variables, including PATH, to specific values, and remove/change them on deactivation. One surprising behavior is that an environment variable set to $nothing will act as if it is not set when querying it (via $nu.env.X), but it is still possible to remove it entirely via `unlet-env`. If the same environment variable is present in the parent scope, the value in the parent scope will be visible to the user. This might be surprising behavior to users who are not familiar with the implementation details. An additional corner case is the the shorthand form of `with-env` does not work with this feature. Using `X=$nothing` will set $nu.env.X to the string "$nothing". The long-form works as expected: `with-env [X $nothing] {...}`. * Remove unused import * Allow all primitives to be convert to strings
2021-08-26 15:15:58 +02:00
pub use crate::evaluate::envvar::EnvVar;
pub use crate::evaluate::scope::Scope;
pub use crate::evaluate::{evaluator, evaluator::evaluate_baseline_expr};
pub use crate::evaluation_context::EvaluationContext;
pub use crate::example::Example;
pub use crate::filesystem::dir_info::{DirBuilder, DirInfo, FileInfo};
pub use crate::filesystem::filesystem_shell::FilesystemShell;
pub use crate::from_value::FromValue;
pub use crate::maybe_text_codec::{BufCodecReader, MaybeTextCodec, StringOrBinary};
pub use crate::print::maybe_print_errors;
pub use crate::shell::painter::Painter;
pub use crate::shell::palette::{DefaultPalette, Palette};
pub use crate::shell::shell_manager::ShellManager;
pub use crate::shell::value_shell;
pub use crate::whole_stream_command::{whole_stream_command, Command, WholeStreamCommand};