mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 10:25:42 +02:00
Move config to be an env var (#5230)
* Move config to be an env var * fix fmt and tests
This commit is contained in:
@ -5,7 +5,7 @@ use nu_protocol::{
|
||||
ImportPatternMember, Pipeline,
|
||||
},
|
||||
engine::StateWorkingSet,
|
||||
span, Exportable, Overlay, PositionalArg, Span, SyntaxShape, Type, CONFIG_VARIABLE_ID,
|
||||
span, Exportable, Overlay, PositionalArg, Span, SyntaxShape, Type,
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
use std::path::{Path, PathBuf};
|
||||
@ -1710,9 +1710,7 @@ pub fn parse_let(
|
||||
let rhs_type = rvalue.ty.clone();
|
||||
|
||||
if let Some(var_id) = var_id {
|
||||
if var_id != CONFIG_VARIABLE_ID {
|
||||
working_set.set_variable_type(var_id, rhs_type);
|
||||
}
|
||||
working_set.set_variable_type(var_id, rhs_type);
|
||||
}
|
||||
|
||||
let call = Box::new(Call {
|
||||
|
@ -14,7 +14,7 @@ use nu_protocol::{
|
||||
},
|
||||
engine::StateWorkingSet,
|
||||
span, BlockId, Flag, PositionalArg, Signature, Span, Spanned, SyntaxShape, Type, Unit, VarId,
|
||||
CONFIG_VARIABLE_ID, ENV_VARIABLE_ID, IN_VARIABLE_ID,
|
||||
ENV_VARIABLE_ID, IN_VARIABLE_ID,
|
||||
};
|
||||
|
||||
use crate::parse_keywords::{
|
||||
@ -1689,16 +1689,6 @@ pub fn parse_variable_expr(
|
||||
},
|
||||
None,
|
||||
);
|
||||
} else if contents == b"$config" {
|
||||
return (
|
||||
Expression {
|
||||
expr: Expr::Var(nu_protocol::CONFIG_VARIABLE_ID),
|
||||
span,
|
||||
ty: Type::Any,
|
||||
custom_completion: None,
|
||||
},
|
||||
None,
|
||||
);
|
||||
} else if contents == b"$env" {
|
||||
return (
|
||||
Expression {
|
||||
@ -2818,16 +2808,6 @@ pub fn parse_var_with_opt_type(
|
||||
Some(ParseError::MissingType(spans[*spans_idx])),
|
||||
)
|
||||
}
|
||||
} else if bytes == b"$config" || bytes == b"config" {
|
||||
(
|
||||
Expression {
|
||||
expr: Expr::Var(CONFIG_VARIABLE_ID),
|
||||
span: spans[*spans_idx],
|
||||
ty: Type::Any,
|
||||
custom_completion: None,
|
||||
},
|
||||
None,
|
||||
)
|
||||
} else {
|
||||
let id =
|
||||
working_set.add_variable(bytes, span(&spans[*spans_idx..*spans_idx + 1]), Type::Any);
|
||||
|
Reference in New Issue
Block a user