diff --git a/crates/nu-command/src/default_context.rs b/crates/nu-command/src/default_context.rs index 369d7bd863..3ed3027441 100644 --- a/crates/nu-command/src/default_context.rs +++ b/crates/nu-command/src/default_context.rs @@ -200,6 +200,7 @@ pub fn create_default_context() -> EngineState { StrDistance, StrDowncase, StrEndswith, + StrJoin, StrReplace, StrIndexOf, StrKebabCase, diff --git a/crates/nu-command/src/example_test.rs b/crates/nu-command/src/example_test.rs index e570136129..0180262954 100644 --- a/crates/nu-command/src/example_test.rs +++ b/crates/nu-command/src/example_test.rs @@ -14,7 +14,7 @@ use crate::To; #[cfg(test)] use super::{ Ansi, Date, From, If, Into, LetEnv, Math, Path, Random, Split, SplitColumn, SplitRow, Str, - StrCollect, StrLength, StrReplace, Url, Wrap, + StrJoin, StrLength, StrReplace, Url, Wrap, }; #[cfg(test)] @@ -29,7 +29,7 @@ pub fn test_examples(cmd: impl Command + 'static) { // Try to keep this working set small to keep tests running as fast as possible let mut working_set = StateWorkingSet::new(&*engine_state); working_set.add_decl(Box::new(Str)); - working_set.add_decl(Box::new(StrCollect)); + working_set.add_decl(Box::new(StrJoin)); working_set.add_decl(Box::new(StrLength)); working_set.add_decl(Box::new(StrReplace)); working_set.add_decl(Box::new(BuildString)); diff --git a/crates/nu-command/src/strings/str_/join.rs b/crates/nu-command/src/strings/str_/join.rs index 551594ab91..fe8f659514 100644 --- a/crates/nu-command/src/strings/str_/join.rs +++ b/crates/nu-command/src/strings/str_/join.rs @@ -7,15 +7,15 @@ use nu_protocol::{ }; #[derive(Clone)] -pub struct StrCollect; +pub struct StrJoin; -impl Command for StrCollect { +impl Command for StrJoin { fn name(&self) -> &str { - "str collect" + "str join" } fn signature(&self) -> Signature { - Signature::build("str collect") + Signature::build("str join") .optional( "separator", SyntaxShape::String, @@ -29,7 +29,7 @@ impl Command for StrCollect { } fn search_terms(&self) -> Vec<&str> { - vec!["join", "concatenate"] + vec!["collect", "concatenate"] } fn run( @@ -76,7 +76,7 @@ impl Command for StrCollect { vec![ Example { description: "Create a string from input", - example: "['nu', 'shell'] | str collect", + example: "['nu', 'shell'] | str join", result: Some(Value::String { val: "nushell".to_string(), span: Span::test_data(), @@ -84,7 +84,7 @@ impl Command for StrCollect { }, Example { description: "Create a string from input with a separator", - example: "['nu', 'shell'] | str collect '-'", + example: "['nu', 'shell'] | str join '-'", result: Some(Value::String { val: "nu-shell".to_string(), span: Span::test_data(), @@ -101,6 +101,6 @@ mod tests { fn test_examples() { use crate::test_examples; - test_examples(StrCollect {}) + test_examples(StrJoin {}) } } diff --git a/crates/nu-command/src/strings/str_/mod.rs b/crates/nu-command/src/strings/str_/mod.rs index cbe3ee0050..26744205b5 100644 --- a/crates/nu-command/src/strings/str_/mod.rs +++ b/crates/nu-command/src/strings/str_/mod.rs @@ -4,6 +4,7 @@ mod contains; mod distance; mod ends_with; mod index_of; +mod join; mod length; mod lpad; mod replace; @@ -19,6 +20,7 @@ pub use contains::SubCommand as StrContains; pub use distance::SubCommand as StrDistance; pub use ends_with::SubCommand as StrEndswith; pub use index_of::SubCommand as StrIndexOf; +pub use join::*; pub use length::SubCommand as StrLength; pub use lpad::SubCommand as StrLpad; pub use replace::SubCommand as StrReplace;