From fa2d9a8a588423e92d8e3787801b444e46cf90a4 Mon Sep 17 00:00:00 2001 From: Michael Angerman <1809991+stormasm@users.noreply.github.com> Date: Sun, 6 Aug 2023 09:08:45 -0700 Subject: [PATCH] Categorification: move uncategorized String commands to Category::Strings (#9931) In an effort to go through and review all of the remaining commands to find anything else that could possibly be moved to *nu-cmd-extra* I noticed that there are still some commands that have not been categorized... I am going to *Categorize* the remaining commands that still *do not have Category homes* In PR land I will call this *Categorification* as a play off of *Cratification* * str substring * str trim * str upcase were in the *default* category because for some reason they had not yet been categorized. I went ahead and moved them to the ```rust .category(Category::Strings) ``` --- crates/nu-command/src/strings/str_/case/upcase.rs | 2 ++ crates/nu-command/src/strings/str_/substring.rs | 2 ++ crates/nu-command/src/strings/str_/trim/trim_.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/crates/nu-command/src/strings/str_/case/upcase.rs b/crates/nu-command/src/strings/str_/case/upcase.rs index a4d580502d..ffb6e24869 100644 --- a/crates/nu-command/src/strings/str_/case/upcase.rs +++ b/crates/nu-command/src/strings/str_/case/upcase.rs @@ -2,6 +2,7 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::ast::CellPath; use nu_protocol::engine::{Command, EngineState, Stack}; +use nu_protocol::Category; use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value}; #[derive(Clone)] @@ -29,6 +30,7 @@ impl Command for SubCommand { SyntaxShape::CellPath, "For a data structure input, convert strings at the given cell paths", ) + .category(Category::Strings) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/strings/str_/substring.rs b/crates/nu-command/src/strings/str_/substring.rs index 44843e8311..c5ad1a6404 100644 --- a/crates/nu-command/src/strings/str_/substring.rs +++ b/crates/nu-command/src/strings/str_/substring.rs @@ -5,6 +5,7 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::ast::CellPath; use nu_protocol::engine::{Command, EngineState, Stack}; +use nu_protocol::Category; use nu_protocol::{ Example, PipelineData, Range, ShellError, Signature, Span, SyntaxShape, Type, Value, }; @@ -69,6 +70,7 @@ impl Command for SubCommand { SyntaxShape::CellPath, "For a data structure input, turn strings at the given cell paths into substrings", ) + .category(Category::Strings) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/strings/str_/trim/trim_.rs b/crates/nu-command/src/strings/str_/trim/trim_.rs index 9fb994a0e0..99fe2ba756 100644 --- a/crates/nu-command/src/strings/str_/trim/trim_.rs +++ b/crates/nu-command/src/strings/str_/trim/trim_.rs @@ -1,5 +1,6 @@ use nu_cmd_base::input_handler::{operate, CmdArgument}; use nu_engine::CallExt; +use nu_protocol::Category; use nu_protocol::{ ast::{Call, CellPath}, engine::{Command, EngineState, Stack}, @@ -66,6 +67,7 @@ impl Command for SubCommand { "trims characters only from the end of the string", Some('r'), ) + .category(Category::Strings) } fn usage(&self) -> &str { "Trim whitespace or specific character."