mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 03:05:59 +02:00
Simplify expressions (#3389)
* WIP: experiment with simpler expressions * fix simple invoke * update tests * fix a few tests * Make paren parsing more robust * fix external args * Remove old invocation * Update tests * Update tests
This commit is contained in:
@@ -5,6 +5,7 @@ use log::{log_enabled, trace};
|
||||
use crate::evaluation_context::EvaluationContext;
|
||||
use nu_errors::ShellError;
|
||||
use nu_protocol::hir::SpannedExpression;
|
||||
use nu_protocol::{UntaggedValue, Value};
|
||||
use nu_stream::{InputStream, ToInputStream};
|
||||
|
||||
pub(crate) fn run_expression_block(
|
||||
@@ -18,5 +19,11 @@ pub(crate) fn run_expression_block(
|
||||
|
||||
let output = evaluate_baseline_expr(expr, ctx)?;
|
||||
|
||||
Ok(std::iter::once(Ok(output)).to_input_stream())
|
||||
match output {
|
||||
Value {
|
||||
value: UntaggedValue::Table(x),
|
||||
..
|
||||
} => Ok(InputStream::from_stream(x.into_iter())),
|
||||
output => Ok(std::iter::once(Ok(output)).to_input_stream()),
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ fn test_parse_invocation_with_range() {
|
||||
cwd: ".",
|
||||
r#"
|
||||
let foo = 3
|
||||
echo $(echo 1..$foo | each { echo $it }) | to json
|
||||
echo (echo 1..$foo | each { $it }) | to json
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "[1,2,3]")
|
||||
|
Reference in New Issue
Block a user