mirror of
https://github.com/nushell/nushell
synced 2025-01-13 21:55:07 +00:00
Move capitalize, downcase, upcase to /cases; fix some example descriptions; clarify usage text (#5572)
Co-authored-by: kyle <kyle@archtop.local>
This commit is contained in:
parent
7a78171b34
commit
3e09158afc
9 changed files with 16 additions and 16 deletions
|
@ -24,7 +24,7 @@ impl Command for SubCommand {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Capitalize text"
|
||||
"Capitalize first letter of text"
|
||||
}
|
||||
|
||||
fn run(
|
|
@ -1,16 +1,22 @@
|
|||
pub mod camel_case;
|
||||
pub mod capitalize;
|
||||
pub mod downcase;
|
||||
pub mod kebab_case;
|
||||
pub mod pascal_case;
|
||||
pub mod screaming_snake_case;
|
||||
pub mod snake_case;
|
||||
pub mod str_;
|
||||
pub mod upcase;
|
||||
|
||||
pub use camel_case::SubCommand as StrCamelCase;
|
||||
pub use capitalize::SubCommand as StrCapitalize;
|
||||
pub use downcase::SubCommand as StrDowncase;
|
||||
pub use kebab_case::SubCommand as StrKebabCase;
|
||||
pub use pascal_case::SubCommand as StrPascalCase;
|
||||
pub use screaming_snake_case::SubCommand as StrScreamingSnakeCase;
|
||||
pub use snake_case::SubCommand as StrSnakeCase;
|
||||
pub use str_::Str;
|
||||
pub use upcase::SubCommand as StrUpcase;
|
||||
|
||||
use nu_engine::CallExt;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Command for SubCommand {
|
|||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "convert a string to camelCase",
|
||||
description: "convert a string to SCREAMING_SNAKE_CASE",
|
||||
example: r#" "NuShell" | str screaming-snake-case"#,
|
||||
result: Some(Value::String {
|
||||
val: "NU_SHELL".to_string(),
|
||||
|
@ -49,7 +49,7 @@ impl Command for SubCommand {
|
|||
}),
|
||||
},
|
||||
Example {
|
||||
description: "convert a string to camelCase",
|
||||
description: "convert a string to SCREAMING_SNAKE_CASE",
|
||||
example: r#" "this_is_the_second_case" | str screaming-snake-case"#,
|
||||
result: Some(Value::String {
|
||||
val: "THIS_IS_THE_SECOND_CASE".to_string(),
|
||||
|
@ -57,7 +57,7 @@ impl Command for SubCommand {
|
|||
}),
|
||||
},
|
||||
Example {
|
||||
description: "convert a string to camelCase",
|
||||
description: "convert a string to SCREAMING_SNAKE_CASE",
|
||||
example: r#""this-is-the-first-case" | str screaming-snake-case"#,
|
||||
result: Some(Value::String {
|
||||
val: "THIS_IS_THE_FIRST_CASE".to_string(),
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Command for SubCommand {
|
|||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "convert a string to camelCase",
|
||||
description: "convert a string to snake_case",
|
||||
example: r#" "NuShell" | str snake-case"#,
|
||||
result: Some(Value::String {
|
||||
val: "nu_shell".to_string(),
|
||||
|
@ -48,7 +48,7 @@ impl Command for SubCommand {
|
|||
}),
|
||||
},
|
||||
Example {
|
||||
description: "convert a string to camelCase",
|
||||
description: "convert a string to snake_case",
|
||||
example: r#" "this_is_the_second_case" | str snake-case"#,
|
||||
result: Some(Value::String {
|
||||
val: "this_is_the_second_case".to_string(),
|
||||
|
@ -56,7 +56,7 @@ impl Command for SubCommand {
|
|||
}),
|
||||
},
|
||||
Example {
|
||||
description: "convert a string to camelCase",
|
||||
description: "convert a string to snake_case",
|
||||
example: r#""this-is-the-first-case" | str snake-case"#,
|
||||
result: Some(Value::String {
|
||||
val: "this_is_the_first_case".to_string(),
|
||||
|
@ -64,7 +64,7 @@ impl Command for SubCommand {
|
|||
}),
|
||||
},
|
||||
Example {
|
||||
description: "convert a column from a table to snake-case",
|
||||
description: "convert a column from a table to snake_case",
|
||||
example: r#"[[lang, gems]; [nuTest, 100]] | str snake-case lang"#,
|
||||
result: Some(Value::List {
|
||||
vals: vec![Value::Record {
|
||||
|
|
|
@ -18,7 +18,7 @@ impl Command for Str {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Various commands for working with string data."
|
||||
"Various commands for working with string data"
|
||||
}
|
||||
|
||||
fn run(
|
||||
|
|
|
@ -48,7 +48,7 @@ impl Command for SubCommand {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Returns starting index of given pattern in string counting from 0. Returns -1 when there are no results."
|
||||
"Returns start index of first occurrence of pattern in string, or -1 if no match"
|
||||
}
|
||||
|
||||
fn run(
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
mod capitalize;
|
||||
mod case;
|
||||
mod collect;
|
||||
mod contains;
|
||||
mod downcase;
|
||||
mod ends_with;
|
||||
mod index_of;
|
||||
mod length;
|
||||
|
@ -13,13 +11,10 @@ mod rpad;
|
|||
mod starts_with;
|
||||
mod substring;
|
||||
mod trim;
|
||||
mod upcase;
|
||||
|
||||
pub use capitalize::SubCommand as StrCapitalize;
|
||||
pub use case::*;
|
||||
pub use collect::*;
|
||||
pub use contains::SubCommand as StrContains;
|
||||
pub use downcase::SubCommand as StrDowncase;
|
||||
pub use ends_with::SubCommand as StrEndswith;
|
||||
pub use index_of::SubCommand as StrIndexOf;
|
||||
pub use length::SubCommand as StrLength;
|
||||
|
@ -30,4 +25,3 @@ pub use rpad::SubCommand as StrRpad;
|
|||
pub use starts_with::SubCommand as StrStartsWith;
|
||||
pub use substring::SubCommand as StrSubstring;
|
||||
pub use trim::Trim as StrTrim;
|
||||
pub use upcase::SubCommand as StrUpcase;
|
||||
|
|
Loading…
Reference in a new issue