port group-by date to engine-p (#3556)

* migrate `group_by_date.rs` to engine-p

Part of #3390.
This commit is contained in:
Eli Flanagan 2021-06-04 11:58:22 -04:00 committed by GitHub
parent 4bca36f479
commit 51890baace
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use crate::utils::suggestions::suggestions;
use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value};
use nu_source::Tagged;
pub struct GroupByDate;
@ -31,7 +31,7 @@ impl WholeStreamCommand for GroupByDate {
"creates a table grouped by date."
}
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
group_by_date(args)
}
@ -52,7 +52,7 @@ enum GroupByColumn {
Name(Option<Tagged<String>>),
}
pub fn group_by_date(args: CommandArgs) -> Result<ActionStream, ShellError> {
pub fn group_by_date(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name = args.call_info.name_tag.clone();
let args = args.evaluate_once()?;
let column_name: Option<Tagged<String>> = args.opt(0)?;
@ -116,7 +116,7 @@ pub fn group_by_date(args: CommandArgs) -> Result<ActionStream, ShellError> {
}
};
Ok(ActionStream::one(ReturnSuccess::value(value_result?)))
Ok(OutputStream::one(value_result?))
}
}