mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 20:47:44 +02:00
Move $nu.env to $env (#665)
* Move env from nu builtin to its own * update samples/tests
This commit is contained in:
@ -495,10 +495,10 @@ pub fn parse_module_block(
|
||||
// TODO: Exported env vars are usable iside the module only if correctly
|
||||
// exported by the user. For example:
|
||||
//
|
||||
// > module foo { export env a { "2" }; export def b [] { $nu.env.a } }
|
||||
// > module foo { export env a { "2" }; export def b [] { $env.a } }
|
||||
//
|
||||
// will work only if you call `use foo *; b` but not with `use foo; foo b`
|
||||
// since in the second case, the name of the env var would be $nu.env."foo a".
|
||||
// since in the second case, the name of the env var would be $env."foo a".
|
||||
b"export" => {
|
||||
let (stmt, exportable, err) =
|
||||
parse_export(working_set, &pipeline.commands[0].parts);
|
||||
|
@ -1331,6 +1331,16 @@ pub fn parse_variable_expr(
|
||||
},
|
||||
None,
|
||||
);
|
||||
} else if contents == b"$env" {
|
||||
return (
|
||||
Expression {
|
||||
expr: Expr::Var(nu_protocol::ENV_VARIABLE_ID),
|
||||
span,
|
||||
ty: Type::Unknown,
|
||||
custom_completion: None,
|
||||
},
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
let (id, err) = parse_variable(working_set, span);
|
||||
|
Reference in New Issue
Block a user