From 2b92e3e8a7b55e54da9778444795eb967271cceb Mon Sep 17 00:00:00 2001 From: Eli Flanagan Date: Fri, 21 May 2021 22:19:43 -0400 Subject: [PATCH] port group-by to engine-p (#3458) * migrate group-by to engine p Part of #3390. * consume positional argument correctly --- crates/nu-command/src/commands/group_by.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/nu-command/src/commands/group_by.rs b/crates/nu-command/src/commands/group_by.rs index 5d6d1eb41e..f818dce85f 100644 --- a/crates/nu-command/src/commands/group_by.rs +++ b/crates/nu-command/src/commands/group_by.rs @@ -9,11 +9,6 @@ use nu_value_ext::as_string; pub struct Command; -#[derive(Deserialize)] -pub struct Arguments { - grouper: Option, -} - impl WholeStreamCommand for Command { fn name(&self) -> &str { "group-by" @@ -131,9 +126,10 @@ enum Grouper { pub fn group_by(args: CommandArgs) -> Result { let name = args.call_info.name_tag.clone(); let context = Arc::new(EvaluationContext::from_args(&args)); - let (Arguments { grouper }, input) = args.process()?; + let args = args.evaluate_once()?; - let values: Vec = input.collect(); + let grouper = args.opt(0)?; + let values: Vec = args.input.collect(); let mut keys: Vec> = vec![]; let mut group_strategy = Grouper::ByColumn(None);