refactor: rename subcommand structs (#15309)

Came from [this
discussion](https://discord.com/channels/601130461678272522/1348791953784836147/1349699872059691038)
on discord with @fdncred

# Description
Small refactoring where I rename commands from "SubCommand" to its
proper name. Motivations: better clarity (although subjective), better
searchable, consistency.

The only commands I didn't touch were "split list" and "ansi gradient"
because of name clashes.

# User-Facing Changes
None

# Tests + Formatting
cargo fmt and clippy OK

# After Submitting
nothing required
This commit is contained in:
Loïc Riegel
2025-03-14 02:00:35 +01:00
committed by GitHub
parent 33001d1992
commit 8f634f4140
128 changed files with 439 additions and 439 deletions

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathArcCos;
impl Command for SubCommand {
impl Command for MathArcCos {
fn name(&self) -> &str {
"math arccos"
}
@ -114,6 +114,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathArcCos {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathArcCosH;
impl Command for SubCommand {
impl Command for MathArcCosH {
fn name(&self) -> &str {
"math arccosh"
}
@ -100,6 +100,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathArcCosH {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathArcSin;
impl Command for SubCommand {
impl Command for MathArcSin {
fn name(&self) -> &str {
"math arcsin"
}
@ -115,6 +115,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathArcSin {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathArcSinH;
impl Command for SubCommand {
impl Command for MathArcSinH {
fn name(&self) -> &str {
"math arcsinh"
}
@ -88,6 +88,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathArcSinH {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathArcTan;
impl Command for SubCommand {
impl Command for MathArcTan {
fn name(&self) -> &str {
"math arctan"
}
@ -102,6 +102,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathArcTan {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathArcTanH;
impl Command for SubCommand {
impl Command for MathArcTanH {
fn name(&self) -> &str {
"math arctanh"
}
@ -101,6 +101,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathArcTanH {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathCos;
impl Command for SubCommand {
impl Command for MathCos {
fn name(&self) -> &str {
"math cos"
}
@ -108,6 +108,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathCos {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathCosH;
impl Command for SubCommand {
impl Command for MathCosH {
fn name(&self) -> &str {
"math cosh"
}
@ -88,6 +88,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathCosH {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathExp;
impl Command for SubCommand {
impl Command for MathExp {
fn name(&self) -> &str {
"math exp"
}
@ -93,6 +93,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathExp {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathLn;
impl Command for SubCommand {
impl Command for MathLn {
fn name(&self) -> &str {
"math ln"
}
@ -100,6 +100,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathLn {})
}
}

View File

@ -15,19 +15,19 @@ mod arcsinh;
mod arctan;
mod arctanh;
pub use cos::SubCommand as MathCos;
pub use cosh::SubCommand as MathCosH;
pub use sin::SubCommand as MathSin;
pub use sinh::SubCommand as MathSinH;
pub use tan::SubCommand as MathTan;
pub use tanh::SubCommand as MathTanH;
pub use cos::MathCos;
pub use cosh::MathCosH;
pub use sin::MathSin;
pub use sinh::MathSinH;
pub use tan::MathTan;
pub use tanh::MathTanH;
pub use exp::SubCommand as MathExp;
pub use ln::SubCommand as MathLn;
pub use exp::MathExp;
pub use ln::MathLn;
pub use arccos::SubCommand as MathArcCos;
pub use arccosh::SubCommand as MathArcCosH;
pub use arcsin::SubCommand as MathArcSin;
pub use arcsinh::SubCommand as MathArcSinH;
pub use arctan::SubCommand as MathArcTan;
pub use arctanh::SubCommand as MathArcTanH;
pub use arccos::MathArcCos;
pub use arccosh::MathArcCosH;
pub use arcsin::MathArcSin;
pub use arcsinh::MathArcSinH;
pub use arctan::MathArcTan;
pub use arctanh::MathArcTanH;

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathSin;
impl Command for SubCommand {
impl Command for MathSin {
fn name(&self) -> &str {
"math sin"
}
@ -108,6 +108,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathSin {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathSinH;
impl Command for SubCommand {
impl Command for MathSinH {
fn name(&self) -> &str {
"math sinh"
}
@ -87,6 +87,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathSinH {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathTan;
impl Command for SubCommand {
impl Command for MathTan {
fn name(&self) -> &str {
"math tan"
}
@ -106,6 +106,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathTan {})
}
}

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathTanH;
impl Command for SubCommand {
impl Command for MathTanH {
fn name(&self) -> &str {
"math tanh"
}
@ -86,6 +86,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathTanH {})
}
}

View File

@ -3,9 +3,9 @@ use heck::ToLowerCamelCase;
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrCamelCase;
impl Command for SubCommand {
impl Command for StrCamelCase {
fn name(&self) -> &str {
"str camel-case"
}
@ -91,6 +91,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrCamelCase {})
}
}

View File

@ -3,9 +3,9 @@ use heck::ToKebabCase;
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrKebabCase;
impl Command for SubCommand {
impl Command for StrKebabCase {
fn name(&self) -> &str {
"str kebab-case"
}
@ -90,6 +90,6 @@ mod tests {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrKebabCase {})
}
}

View File

@ -6,13 +6,13 @@ mod snake_case;
mod str_;
mod title_case;
pub use camel_case::SubCommand as StrCamelCase;
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 camel_case::StrCamelCase;
pub use kebab_case::StrKebabCase;
pub use pascal_case::StrPascalCase;
pub use screaming_snake_case::StrScreamingSnakeCase;
pub use snake_case::StrSnakeCase;
pub use str_::Str;
pub use title_case::SubCommand as StrTitleCase;
pub use title_case::StrTitleCase;
use nu_cmd_base::input_handler::{operate as general_operate, CmdArgument};
use nu_engine::command_prelude::*;

View File

@ -3,9 +3,9 @@ use heck::ToUpperCamelCase;
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrPascalCase;
impl Command for SubCommand {
impl Command for StrPascalCase {
fn name(&self) -> &str {
"str pascal-case"
}
@ -91,6 +91,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrPascalCase {})
}
}

View File

@ -3,9 +3,9 @@ use heck::ToShoutySnakeCase;
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrScreamingSnakeCase;
impl Command for SubCommand {
impl Command for StrScreamingSnakeCase {
fn name(&self) -> &str {
"str screaming-snake-case"
}
@ -91,6 +91,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrScreamingSnakeCase {})
}
}

View File

@ -3,9 +3,9 @@ use heck::ToSnakeCase;
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrSnakeCase;
impl Command for SubCommand {
impl Command for StrSnakeCase {
fn name(&self) -> &str {
"str snake-case"
}
@ -91,6 +91,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrSnakeCase {})
}
}

View File

@ -3,9 +3,9 @@ use heck::ToTitleCase;
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrTitleCase;
impl Command for SubCommand {
impl Command for StrTitleCase {
fn name(&self) -> &str {
"str title-case"
}
@ -86,6 +86,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrTitleCase {})
}
}