From 7248de1167dcf886c4747b653ec144ef5e8ae68b Mon Sep 17 00:00:00 2001 From: Michael Angerman <1809991+stormasm@users.noreply.github.com> Date: Mon, 7 Aug 2023 08:33:30 -0700 Subject: [PATCH] Categorification: move from Default category to Filters (#9945) The following *Filters* commands were incorrectly in the category *Default* * group-by * join * reduce * split-by * transpose This continues the effort of moving commands out of default and into their proper category... --- crates/nu-command/src/filters/group_by.rs | 4 +++- crates/nu-command/src/filters/join.rs | 3 ++- crates/nu-command/src/filters/reduce.rs | 4 +++- crates/nu-command/src/filters/split_by.rs | 5 +++-- crates/nu-command/src/filters/transpose.rs | 5 +++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/nu-command/src/filters/group_by.rs b/crates/nu-command/src/filters/group_by.rs index 7e0043b734..40317815f3 100644 --- a/crates/nu-command/src/filters/group_by.rs +++ b/crates/nu-command/src/filters/group_by.rs @@ -2,7 +2,8 @@ use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::{Call, CellPath}; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, + Type, Value, }; use indexmap::IndexMap; @@ -35,6 +36,7 @@ impl Command for GroupBy { ]), "the path to the column to group on", ) + .category(Category::Filters) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/filters/join.rs b/crates/nu-command/src/filters/join.rs index 8786ec126d..48ea524cd6 100644 --- a/crates/nu-command/src/filters/join.rs +++ b/crates/nu-command/src/filters/join.rs @@ -2,7 +2,7 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Config, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, + Category, Config, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; use std::cmp::max; use std::collections::{HashMap, HashSet}; @@ -53,6 +53,7 @@ impl Command for Join { .switch("right", "Right-outer join", Some('r')) .switch("outer", "Outer join", Some('o')) .input_output_types(vec![(Type::Table(vec![]), Type::Table(vec![]))]) + .category(Category::Filters) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/filters/reduce.rs b/crates/nu-command/src/filters/reduce.rs index 71ea317f32..17f6d322f7 100644 --- a/crates/nu-command/src/filters/reduce.rs +++ b/crates/nu-command/src/filters/reduce.rs @@ -3,7 +3,8 @@ use nu_engine::{eval_block_with_early_return, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, + Value, }; #[derive(Clone)] @@ -37,6 +38,7 @@ impl Command for Reduce { "reducing function", ) .allow_variants_without_examples(true) + .category(Category::Filters) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/filters/split_by.rs b/crates/nu-command/src/filters/split_by.rs index 4f989ac5b8..af3175e3d8 100644 --- a/crates/nu-command/src/filters/split_by.rs +++ b/crates/nu-command/src/filters/split_by.rs @@ -3,8 +3,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, - Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned, + SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -19,6 +19,7 @@ impl Command for SplitBy { Signature::build("split-by") .input_output_types(vec![(Type::Record(vec![]), Type::Record(vec![]))]) .optional("splitter", SyntaxShape::Any, "the splitter value to use") + .category(Category::Filters) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/filters/transpose.rs b/crates/nu-command/src/filters/transpose.rs index 326acd8ae6..0116400ea0 100644 --- a/crates/nu-command/src/filters/transpose.rs +++ b/crates/nu-command/src/filters/transpose.rs @@ -3,8 +3,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, Spanned, - SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, + Spanned, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -61,6 +61,7 @@ impl Command for Transpose { SyntaxShape::String, "the names to give columns once transposed", ) + .category(Category::Filters) } fn usage(&self) -> &str {