forked from extern/nushell
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:
@@ -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 {
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user