mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 00:38:56 +02:00
Rename cond math (#2807)
* Simplifies 'if' to work on the available scope rather than a stream * Rename initializer/math for better readability * Fix description * fmt
This commit is contained in:
@ -26,7 +26,7 @@ impl WholeStreamCommand for If {
|
||||
Signature::build("if")
|
||||
.required(
|
||||
"condition",
|
||||
SyntaxShape::Math,
|
||||
SyntaxShape::MathExpression,
|
||||
"the condition that must match",
|
||||
)
|
||||
.required(
|
||||
|
@ -18,7 +18,7 @@ impl WholeStreamCommand for SubCommand {
|
||||
Signature::build("keep until")
|
||||
.required(
|
||||
"condition",
|
||||
SyntaxShape::Math,
|
||||
SyntaxShape::RowCondition,
|
||||
"The condition that must be met to stop keeping rows",
|
||||
)
|
||||
.filter()
|
||||
|
@ -17,7 +17,7 @@ impl WholeStreamCommand for SubCommand {
|
||||
Signature::build("keep while")
|
||||
.required(
|
||||
"condition",
|
||||
SyntaxShape::Math,
|
||||
SyntaxShape::RowCondition,
|
||||
"The condition that must be met to keep rows",
|
||||
)
|
||||
.filter()
|
||||
|
@ -29,7 +29,7 @@ impl WholeStreamCommand for Set {
|
||||
.required("equals", SyntaxShape::String, "the equals sign")
|
||||
.required(
|
||||
"expr",
|
||||
SyntaxShape::Initializer,
|
||||
SyntaxShape::MathExpression,
|
||||
"the value to set the variable to",
|
||||
)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ impl WholeStreamCommand for SetEnv {
|
||||
.required("equals", SyntaxShape::String, "the equals sign")
|
||||
.required(
|
||||
"expr",
|
||||
SyntaxShape::Initializer,
|
||||
SyntaxShape::MathExpression,
|
||||
"the value to set the environment variable to",
|
||||
)
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ impl WholeStreamCommand for SubCommand {
|
||||
Signature::build("skip until")
|
||||
.required(
|
||||
"condition",
|
||||
SyntaxShape::Math,
|
||||
SyntaxShape::RowCondition,
|
||||
"The condition that must be met to stop skipping",
|
||||
)
|
||||
.filter()
|
||||
|
@ -17,7 +17,7 @@ impl WholeStreamCommand for SubCommand {
|
||||
Signature::build("skip while")
|
||||
.required(
|
||||
"condition",
|
||||
SyntaxShape::Math,
|
||||
SyntaxShape::RowCondition,
|
||||
"The condition that must be met to continue skipping",
|
||||
)
|
||||
.filter()
|
||||
|
@ -22,7 +22,7 @@ impl WholeStreamCommand for Where {
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("where").required(
|
||||
"condition",
|
||||
SyntaxShape::Math,
|
||||
SyntaxShape::RowCondition,
|
||||
"the condition that must match",
|
||||
)
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ fn get_shape_of_expr(expr: &SpannedExpression) -> Option<SyntaxShape> {
|
||||
Expression::ExternalWord => Some(SyntaxShape::String),
|
||||
Expression::Synthetic(_) => Some(SyntaxShape::String),
|
||||
|
||||
Expression::Binary(_) => Some(SyntaxShape::Math),
|
||||
Expression::Binary(_) => Some(SyntaxShape::RowCondition),
|
||||
Expression::Range(_) => Some(SyntaxShape::Range),
|
||||
Expression::List(_) => Some(SyntaxShape::Table),
|
||||
Expression::Boolean(_) => Some(SyntaxShape::String),
|
||||
@ -690,12 +690,13 @@ impl VarSyntaxShapeDeductor {
|
||||
match shape {
|
||||
//If the shape of expr is math, we return the result shape of this math expr if
|
||||
//possible
|
||||
SyntaxShape::Math => self.get_result_shape_of_math_expr_or_insert_dependency(
|
||||
(var, expr),
|
||||
source_bin,
|
||||
(pipeline_idx, pipeline),
|
||||
scope,
|
||||
),
|
||||
SyntaxShape::RowCondition => self
|
||||
.get_result_shape_of_math_expr_or_insert_dependency(
|
||||
(var, expr),
|
||||
source_bin,
|
||||
(pipeline_idx, pipeline),
|
||||
scope,
|
||||
),
|
||||
_ => Ok(Some(shape)),
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user