Make arg eval lazy, remove old arg evaluation code (#3603)

* Remove old argument eval

* Merge main

* fmt

* clippy

* clippy

* clippy
This commit is contained in:
JT
2021-06-11 13:57:01 +12:00
committed by GitHub
parent c4163c3621
commit 8ac572ed27
218 changed files with 448 additions and 1075 deletions

View File

@@ -49,7 +49,6 @@ impl WholeStreamCommand for Command {
}
fn keep(args: CommandArgs) -> Result<OutputStream, ShellError> {
let args = args.evaluate_once()?;
let rows: Option<Tagged<usize>> = args.opt(0)?;
let rows_desired = if let Some(quantity) = rows {

View File

@@ -33,9 +33,7 @@ impl WholeStreamCommand for SubCommand {
let ctx = Arc::new(EvaluationContext::from_args(&args));
let tag = args.call_info.name_tag.clone();
let call_info = args.evaluate_once()?;
let block: CapturedBlock = call_info.req(0)?;
let block: CapturedBlock = args.req(0)?;
let condition = {
if block.block.block.len() != 1 {
return Err(ShellError::labeled_error(
@@ -65,7 +63,7 @@ impl WholeStreamCommand for SubCommand {
}
};
Ok(call_info
Ok(args
.input
.take_while(move |item| {
let condition = condition.clone();

View File

@@ -32,9 +32,8 @@ impl WholeStreamCommand for SubCommand {
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
let ctx = Arc::new(EvaluationContext::from_args(&args));
let tag = args.call_info.name_tag.clone();
let call_info = args.evaluate_once()?;
let block: CapturedBlock = call_info.req(0)?;
let block: CapturedBlock = args.req(0)?;
let condition = {
if block.block.block.len() != 1 {
return Err(ShellError::labeled_error(
@@ -64,7 +63,7 @@ impl WholeStreamCommand for SubCommand {
}
};
Ok(call_info
Ok(args
.input
.take_while(move |item| {
let condition = condition.clone();