forked from extern/nushell
Treating environment variables as Values (#497)
* Proof of concept treating env vars as Values * Refactor env var collection and method name * Remove unnecessary pub * Move env translations into a new file * Fix LS_COLORS to support any Value * Fix spans during env var translation * Add span to env var in cd * Improve error diagnostics * Fix non-string env vars failing string conversion * Make PROMPT_COMMAND a Block instead of String * Record host env vars to a fake file This will give spans to env vars that would otherwise be without one. Makes errors less confusing. * Add 'env' command to list env vars It will list also their values translated to strings * Sort env command by name; Add env var type * Remove obsolete test
This commit is contained in:
5
crates/nu-command/src/env/let_env.rs
vendored
5
crates/nu-command/src/env/let_env.rs
vendored
@@ -20,7 +20,7 @@ impl Command for LetEnv {
|
||||
.required("var_name", SyntaxShape::String, "variable name")
|
||||
.required(
|
||||
"initial_value",
|
||||
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::String)),
|
||||
SyntaxShape::Keyword(b"=".to_vec(), Box::new(SyntaxShape::Any)),
|
||||
"equals sign followed by value",
|
||||
)
|
||||
.category(Category::Env)
|
||||
@@ -42,9 +42,6 @@ impl Command for LetEnv {
|
||||
.expect("internal error: missing keyword");
|
||||
|
||||
let rhs = eval_expression(engine_state, stack, keyword_expr)?;
|
||||
let rhs = rhs.as_string()?;
|
||||
|
||||
//println!("Adding: {:?} to {}", rhs, var_id);
|
||||
|
||||
stack.add_env_var(env_var, rhs);
|
||||
Ok(PipelineData::new(call.head))
|
||||
|
Reference in New Issue
Block a user