diff --git a/Cargo.lock b/Cargo.lock index 43681fa04..9595b5306 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,16 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -2751,9 +2741,9 @@ dependencies = [ name = "nu-cmd-extra" version = "0.85.1" dependencies = [ - "Inflector", "ahash", "fancy-regex", + "heck", "htmlescape", "nu-ansi-term", "nu-cmd-base", diff --git a/crates/nu-cmd-extra/Cargo.toml b/crates/nu-cmd-extra/Cargo.toml index a21c27e3b..38e695526 100644 --- a/crates/nu-cmd-extra/Cargo.toml +++ b/crates/nu-cmd-extra/Cargo.toml @@ -20,7 +20,7 @@ nu-cmd-base = { path = "../nu-cmd-base", version = "0.85.1" } nu-utils = { path = "../nu-utils", version = "0.85.1" } # Potential dependencies for extras -Inflector = "0.11" +heck = "0.4.1" num-traits = "0.2" ahash = "0.8.3" nu-ansi-term = "0.49.0" diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs index 2ad833114..7db970b98 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs @@ -1,4 +1,4 @@ -use inflector::cases::camelcase::to_camel_case; +use heck::ToLowerCamelCase; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ @@ -50,7 +50,13 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - operate(engine_state, stack, call, input, &to_camel_case) + operate( + engine_state, + stack, + call, + input, + &ToLowerCamelCase::to_lower_camel_case, + ) } fn examples(&self) -> Vec { diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs index 1a8356a64..ece42fca8 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs @@ -1,4 +1,4 @@ -use inflector::cases::kebabcase::to_kebab_case; +use heck::ToKebabCase; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ @@ -50,7 +50,13 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - operate(engine_state, stack, call, input, &to_kebab_case) + operate( + engine_state, + stack, + call, + input, + &ToKebabCase::to_kebab_case, + ) } fn examples(&self) -> Vec { diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs index 7d7d3cc18..a09e35d8c 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs @@ -1,4 +1,4 @@ -use inflector::cases::pascalcase::to_pascal_case; +use heck::ToUpperCamelCase; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ @@ -50,7 +50,13 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - operate(engine_state, stack, call, input, &to_pascal_case) + operate( + engine_state, + stack, + call, + input, + &ToUpperCamelCase::to_upper_camel_case, + ) } fn examples(&self) -> Vec { diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs index 426f00cdb..c17cf137f 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs @@ -1,4 +1,4 @@ -use inflector::cases::screamingsnakecase::to_screaming_snake_case; +use heck::ToShoutySnakeCase; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ @@ -50,7 +50,13 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - operate(engine_state, stack, call, input, &to_screaming_snake_case) + operate( + engine_state, + stack, + call, + input, + &ToShoutySnakeCase::to_shouty_snake_case, + ) } fn examples(&self) -> Vec { diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs index de9a45df3..9d4b9b517 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs @@ -1,4 +1,4 @@ -use inflector::cases::snakecase::to_snake_case; +use heck::ToSnakeCase; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ @@ -49,7 +49,13 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - operate(engine_state, stack, call, input, &to_snake_case) + operate( + engine_state, + stack, + call, + input, + &ToSnakeCase::to_snake_case, + ) } fn examples(&self) -> Vec { diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs index 73b7e769a..9fa69e0f2 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs @@ -1,4 +1,4 @@ -use inflector::cases::titlecase::to_title_case; +use heck::ToTitleCase; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ @@ -50,7 +50,13 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - operate(engine_state, stack, call, input, &to_title_case) + operate( + engine_state, + stack, + call, + input, + &ToTitleCase::to_title_case, + ) } fn examples(&self) -> Vec {