mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Improve $in
handling (#5137)
* Simplify in logic * Add tests * more tests, and fixes
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
use nu_engine::{eval_block, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Value};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, Signature, SyntaxShape, Value,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Collect;
|
||||
@ -42,7 +44,7 @@ impl Command for Collect {
|
||||
|
||||
if let Some(var) = block.signature.get_positional(0) {
|
||||
if let Some(var_id) = &var.var_id {
|
||||
stack.add_var(*var_id, input);
|
||||
stack.add_var(*var_id, input.clone());
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +52,7 @@ impl Command for Collect {
|
||||
engine_state,
|
||||
&mut stack,
|
||||
&block,
|
||||
PipelineData::new(call.head),
|
||||
input.into_pipeline_data(),
|
||||
call.redirect_stdout,
|
||||
call.redirect_stderr,
|
||||
)
|
||||
|
@ -89,7 +89,8 @@ impl Command for FromNuon {
|
||||
let (lite_block, err) = nu_parser::lite_parse(&lexed);
|
||||
error = error.or(err);
|
||||
|
||||
let (mut block, err) = nu_parser::parse_block(&mut working_set, &lite_block, true, &[]);
|
||||
let (mut block, err) =
|
||||
nu_parser::parse_block(&mut working_set, &lite_block, true, &[], false);
|
||||
error = error.or(err);
|
||||
|
||||
if let Some(pipeline) = block.pipelines.get(1) {
|
||||
|
Reference in New Issue
Block a user