Split OutputStream into ActionStream/OutputStream (#3304)

* Split OutputStream into ActionStream/OutputStream

* Fmt

* Missed update

* Cleanup helper names

* Fmt
This commit is contained in:
Jonathan Turner
2021-04-12 14:35:01 +12:00
committed by GitHub
parent dbecbdccd4
commit 5f550a355b
250 changed files with 1006 additions and 926 deletions

View File

@ -28,7 +28,7 @@ impl WholeStreamCommand for Command {
"Keep the number of rows only."
}
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
keep(args)
}
@ -53,7 +53,7 @@ impl WholeStreamCommand for Command {
}
}
fn keep(args: CommandArgs) -> Result<OutputStream, ShellError> {
fn keep(args: CommandArgs) -> Result<ActionStream, ShellError> {
let (Arguments { rows }, input) = args.process()?;
let rows_desired = if let Some(quantity) = rows {
*quantity
@ -61,7 +61,7 @@ fn keep(args: CommandArgs) -> Result<OutputStream, ShellError> {
1
};
Ok(input.take(rows_desired).to_output_stream())
Ok(input.take(rows_desired).to_action_stream())
}
#[cfg(test)]

View File

@ -27,7 +27,7 @@ impl WholeStreamCommand for SubCommand {
"Keeps rows until the condition matches."
}
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
let ctx = Arc::new(EvaluationContext::from_args(&args));
let call_info = args.evaluate_once()?;
@ -93,7 +93,7 @@ impl WholeStreamCommand for SubCommand {
!matches!(result, Ok(ref v) if v.is_true())
})
.to_output_stream())
.to_action_stream())
}
}

View File

@ -26,7 +26,7 @@ impl WholeStreamCommand for SubCommand {
"Keeps rows while the condition matches."
}
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
let ctx = Arc::new(EvaluationContext::from_args(&args));
let call_info = args.evaluate_once()?;
@ -92,7 +92,7 @@ impl WholeStreamCommand for SubCommand {
matches!(result, Ok(ref v) if v.is_true())
})
.to_output_stream())
.to_action_stream())
}
}