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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
128 changed files with 439 additions and 439 deletions

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct CommandlineEdit;
impl Command for SubCommand { impl Command for CommandlineEdit {
fn name(&self) -> &str { fn name(&self) -> &str {
"commandline edit" "commandline edit"
} }

View File

@ -2,9 +2,9 @@ use nu_engine::command_prelude::*;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct CommandlineGetCursor;
impl Command for SubCommand { impl Command for CommandlineGetCursor {
fn name(&self) -> &str { fn name(&self) -> &str {
"commandline get-cursor" "commandline get-cursor"
} }

View File

@ -4,6 +4,6 @@ mod get_cursor;
mod set_cursor; mod set_cursor;
pub use commandline_::Commandline; pub use commandline_::Commandline;
pub use edit::SubCommand as CommandlineEdit; pub use edit::CommandlineEdit;
pub use get_cursor::SubCommand as CommandlineGetCursor; pub use get_cursor::CommandlineGetCursor;
pub use set_cursor::SubCommand as CommandlineSetCursor; pub use set_cursor::CommandlineSetCursor;

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct CommandlineSetCursor;
impl Command for SubCommand { impl Command for CommandlineSetCursor {
fn name(&self) -> &str { fn name(&self) -> &str {
"commandline set-cursor" "commandline set-cursor"
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathTanH;
impl Command for SubCommand { impl Command for MathTanH {
fn name(&self) -> &str { fn name(&self) -> &str {
"math tanh" "math tanh"
} }
@ -86,6 +86,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::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::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct StrCamelCase;
impl Command for SubCommand { impl Command for StrCamelCase {
fn name(&self) -> &str { fn name(&self) -> &str {
"str camel-case" "str camel-case"
} }
@ -91,6 +91,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::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::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct StrKebabCase;
impl Command for SubCommand { impl Command for StrKebabCase {
fn name(&self) -> &str { fn name(&self) -> &str {
"str kebab-case" "str kebab-case"
} }
@ -90,6 +90,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(StrKebabCase {})
} }
} }

View File

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

View File

@ -3,9 +3,9 @@ use heck::ToUpperCamelCase;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct StrPascalCase;
impl Command for SubCommand { impl Command for StrPascalCase {
fn name(&self) -> &str { fn name(&self) -> &str {
"str pascal-case" "str pascal-case"
} }
@ -91,6 +91,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::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::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct StrScreamingSnakeCase;
impl Command for SubCommand { impl Command for StrScreamingSnakeCase {
fn name(&self) -> &str { fn name(&self) -> &str {
"str screaming-snake-case" "str screaming-snake-case"
} }
@ -91,6 +91,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::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::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct StrSnakeCase;
impl Command for SubCommand { impl Command for StrSnakeCase {
fn name(&self) -> &str { fn name(&self) -> &str {
"str snake-case" "str snake-case"
} }
@ -91,6 +91,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::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::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct StrTitleCase;
impl Command for SubCommand { impl Command for StrTitleCase {
fn name(&self) -> &str { fn name(&self) -> &str {
"str title-case" "str title-case"
} }
@ -86,6 +86,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(StrTitleCase {})
} }
} }

View File

@ -13,9 +13,9 @@ impl CmdArgument for Arguments {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoBinary;
impl Command for SubCommand { impl Command for IntoBinary {
fn name(&self) -> &str { fn name(&self) -> &str {
"into binary" "into binary"
} }
@ -204,7 +204,7 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoBinary {})
} }
#[rstest] #[rstest]

View File

@ -2,9 +2,9 @@ use nu_cmd_base::input_handler::{operate, CmdArgument};
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoBool;
impl Command for SubCommand { impl Command for IntoBool {
fn name(&self) -> &str { fn name(&self) -> &str {
"into bool" "into bool"
} }
@ -202,7 +202,7 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoBool {})
} }
#[test] #[test]

View File

@ -49,9 +49,9 @@ impl Zone {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoDatetime;
impl Command for SubCommand { impl Command for IntoDatetime {
fn name(&self) -> &str { fn name(&self) -> &str {
"into datetime" "into datetime"
} }
@ -495,14 +495,14 @@ fn list_human_readable_examples(span: Span) -> Value {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use super::{action, DatetimeFormat, SubCommand, Zone}; use super::{action, DatetimeFormat, IntoDatetime, Zone};
use nu_protocol::Type::Error; use nu_protocol::Type::Error;
#[test] #[test]
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoDatetime {})
} }
#[test] #[test]

View File

@ -4,9 +4,9 @@ use nu_protocol::{ast::Expr, Unit};
const NS_PER_SEC: i64 = 1_000_000_000; const NS_PER_SEC: i64 = 1_000_000_000;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoDuration;
impl Command for SubCommand { impl Command for IntoDuration {
fn name(&self) -> &str { fn name(&self) -> &str {
"into duration" "into duration"
} }
@ -277,7 +277,7 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoDuration {})
} }
const NS_PER_SEC: i64 = 1_000_000_000; const NS_PER_SEC: i64 = 1_000_000_000;

View File

@ -4,9 +4,9 @@ use nu_engine::command_prelude::*;
use nu_utils::get_system_locale; use nu_utils::get_system_locale;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoFilesize;
impl Command for SubCommand { impl Command for IntoFilesize {
fn name(&self) -> &str { fn name(&self) -> &str {
"into filesize" "into filesize"
} }
@ -197,6 +197,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoFilesize {})
} }
} }

View File

@ -2,9 +2,9 @@ use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoFloat;
impl Command for SubCommand { impl Command for IntoFloat {
fn name(&self) -> &str { fn name(&self) -> &str {
"into float" "into float"
} }
@ -134,7 +134,7 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoFloat {})
} }
#[test] #[test]

View File

@ -12,9 +12,9 @@ impl CmdArgument for Arguments {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoGlob;
impl Command for SubCommand { impl Command for IntoGlob {
fn name(&self) -> &str { fn name(&self) -> &str {
"into glob" "into glob"
} }
@ -121,6 +121,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoGlob {})
} }
} }

View File

@ -18,9 +18,9 @@ impl CmdArgument for Arguments {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoInt;
impl Command for SubCommand { impl Command for IntoInt {
fn name(&self) -> &str { fn name(&self) -> &str {
"into int" "into int"
} }
@ -521,7 +521,7 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoInt {})
} }
#[test] #[test]

View File

@ -12,16 +12,16 @@ mod record;
mod string; mod string;
mod value; mod value;
pub use self::bool::SubCommand as IntoBool; pub use binary::IntoBinary;
pub use self::filesize::SubCommand as IntoFilesize; pub use bool::IntoBool;
pub use binary::SubCommand as IntoBinary;
pub use cell_path::IntoCellPath; pub use cell_path::IntoCellPath;
pub use command::Into; pub use command::Into;
pub use datetime::SubCommand as IntoDatetime; pub use datetime::IntoDatetime;
pub use duration::SubCommand as IntoDuration; pub use duration::IntoDuration;
pub use float::SubCommand as IntoFloat; pub use filesize::IntoFilesize;
pub use glob::SubCommand as IntoGlob; pub use float::IntoFloat;
pub use int::SubCommand as IntoInt; pub use glob::IntoGlob;
pub use record::SubCommand as IntoRecord; pub use int::IntoInt;
pub use string::SubCommand as IntoString; pub use record::IntoRecord;
pub use string::IntoString;
pub use value::IntoValue; pub use value::IntoValue;

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use nu_protocol::format_duration_as_timeperiod; use nu_protocol::format_duration_as_timeperiod;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoRecord;
impl Command for SubCommand { impl Command for IntoRecord {
fn name(&self) -> &str { fn name(&self) -> &str {
"into record" "into record"
} }
@ -243,6 +243,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoRecord {})
} }
} }

View File

@ -19,9 +19,9 @@ impl CmdArgument for Arguments {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct IntoString;
impl Command for SubCommand { impl Command for IntoString {
fn name(&self) -> &str { fn name(&self) -> &str {
"into string" "into string"
} }
@ -316,6 +316,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(IntoString {})
} }
} }

View File

@ -4,4 +4,4 @@ mod split_cell_path;
pub use fill::Fill; pub use fill::Fill;
pub use into::*; pub use into::*;
pub use split_cell_path::SubCommand as SplitCellPath; pub use split_cell_path::SplitCellPath;

View File

@ -2,9 +2,9 @@ use nu_engine::command_prelude::*;
use nu_protocol::{ast::PathMember, IntoValue}; use nu_protocol::{ast::PathMember, IntoValue};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SplitCellPath;
impl Command for SubCommand { impl Command for SplitCellPath {
fn name(&self) -> &str { fn name(&self) -> &str {
"split cell-path" "split cell-path"
} }
@ -150,6 +150,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(SplitCellPath {})
} }
} }

View File

@ -4,9 +4,9 @@ use chrono_humanize::HumanTime;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct DateHumanize;
impl Command for SubCommand { impl Command for DateHumanize {
fn name(&self) -> &str { fn name(&self) -> &str {
"date humanize" "date humanize"
} }
@ -101,6 +101,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(DateHumanize {})
} }
} }

View File

@ -2,9 +2,9 @@ use chrono_tz::TZ_VARIANTS;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct DateListTimezones;
impl Command for SubCommand { impl Command for DateListTimezones {
fn name(&self) -> &str { fn name(&self) -> &str {
"date list-timezone" "date list-timezone"
} }

View File

@ -7,8 +7,8 @@ mod to_timezone;
mod utils; mod utils;
pub use date_::Date; pub use date_::Date;
pub use humanize::SubCommand as DateHumanize; pub use humanize::DateHumanize;
pub use list_timezone::SubCommand as DateListTimezones; pub use list_timezone::DateListTimezones;
pub use now::SubCommand as DateNow; pub use now::DateNow;
pub use to_timezone::SubCommand as DateToTimezone; pub use to_timezone::DateToTimezone;
pub(crate) use utils::{generate_strftime_list, parse_date_from_string}; pub(crate) use utils::{generate_strftime_list, parse_date_from_string};

View File

@ -2,9 +2,9 @@ use chrono::Local;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct DateNow;
impl Command for SubCommand { impl Command for DateNow {
fn name(&self) -> &str { fn name(&self) -> &str {
"date now" "date now"
} }

View File

@ -4,9 +4,9 @@ use chrono::{DateTime, FixedOffset, Local, LocalResult, TimeZone};
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct DateToTimezone;
impl Command for SubCommand { impl Command for DateToTimezone {
fn name(&self) -> &str { fn name(&self) -> &str {
"date to-timezone" "date to-timezone"
} }
@ -147,6 +147,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(DateToTimezone {})
} }
} }

View File

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

View File

@ -6,9 +6,9 @@ use nu_engine::command_prelude::*;
const NS_PER_SEC: i64 = 1_000_000_000; const NS_PER_SEC: i64 = 1_000_000_000;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathAvg;
impl Command for SubCommand { impl Command for MathAvg {
fn name(&self) -> &str { fn name(&self) -> &str {
"math avg" "math avg"
} }
@ -104,6 +104,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(MathAvg {})
} }
} }

View File

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

View File

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

View File

@ -2,9 +2,9 @@ use nu_engine::command_prelude::*;
use nu_protocol::Signals; use nu_protocol::Signals;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathLog;
impl Command for SubCommand { impl Command for MathLog {
fn name(&self) -> &str { fn name(&self) -> &str {
"math log" "math log"
} }
@ -159,6 +159,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(MathLog {})
} }
} }

View File

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

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use std::cmp::Ordering; use std::cmp::Ordering;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathMedian;
impl Command for SubCommand { impl Command for MathMedian {
fn name(&self) -> &str { fn name(&self) -> &str {
"math median" "math median"
} }
@ -151,6 +151,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(MathMedian {})
} }
} }

View File

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

View File

@ -17,20 +17,20 @@ mod sum;
mod utils; mod utils;
mod variance; mod variance;
pub use abs::SubCommand as MathAbs; pub use abs::MathAbs;
pub use avg::SubCommand as MathAvg; pub use avg::MathAvg;
pub use ceil::SubCommand as MathCeil; pub use ceil::MathCeil;
pub use floor::SubCommand as MathFloor; pub use floor::MathFloor;
pub use math_::MathCommand as Math; pub use math_::MathCommand as Math;
pub use max::SubCommand as MathMax; pub use max::MathMax;
pub use median::SubCommand as MathMedian; pub use median::MathMedian;
pub use min::SubCommand as MathMin; pub use min::MathMin;
pub use mode::SubCommand as MathMode; pub use mode::MathMode;
pub use product::SubCommand as MathProduct; pub use product::MathProduct;
pub use round::SubCommand as MathRound; pub use round::MathRound;
pub use sqrt::SubCommand as MathSqrt; pub use sqrt::MathSqrt;
pub use stddev::SubCommand as MathStddev; pub use stddev::MathStddev;
pub use sum::SubCommand as MathSum; pub use sum::MathSum;
pub use variance::SubCommand as MathVariance; pub use variance::MathVariance;
pub use self::log::SubCommand as MathLog; pub use log::MathLog;

View File

@ -3,7 +3,7 @@ use nu_engine::command_prelude::*;
use std::{cmp::Ordering, collections::HashMap}; use std::{cmp::Ordering, collections::HashMap};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathMode;
#[derive(Hash, Eq, PartialEq, Debug)] #[derive(Hash, Eq, PartialEq, Debug)]
enum NumberTypes { enum NumberTypes {
@ -28,7 +28,7 @@ impl HashableType {
} }
} }
impl Command for SubCommand { impl Command for MathMode {
fn name(&self) -> &str { fn name(&self) -> &str {
"math mode" "math mode"
} }
@ -183,6 +183,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(MathMode {})
} }
} }

View File

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

View File

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

View File

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

View File

@ -3,9 +3,9 @@ use crate::math::utils::run_with_function;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathStddev;
impl Command for SubCommand { impl Command for MathStddev {
fn name(&self) -> &str { fn name(&self) -> &str {
"math stddev" "math stddev"
} }
@ -111,6 +111,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(MathStddev {})
} }
} }

View File

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

View File

@ -2,9 +2,9 @@ use crate::math::utils::run_with_function;
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct MathVariance;
impl Command for SubCommand { impl Command for MathVariance {
fn name(&self) -> &str { fn name(&self) -> &str {
"math variance" "math variance"
} }
@ -135,6 +135,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(MathVariance {})
} }
} }

View File

@ -6,9 +6,9 @@ use crate::network::http::client::{
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpDelete;
impl Command for SubCommand { impl Command for HttpDelete {
fn name(&self) -> &str { fn name(&self) -> &str {
"http delete" "http delete"
} }
@ -248,6 +248,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpDelete {})
} }
} }

View File

@ -8,9 +8,9 @@ use nu_engine::command_prelude::*;
use super::client::HttpBody; use super::client::HttpBody;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpGet;
impl Command for SubCommand { impl Command for HttpGet {
fn name(&self) -> &str { fn name(&self) -> &str {
"http get" "http get"
} }
@ -216,6 +216,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpGet {})
} }
} }

View File

@ -8,9 +8,9 @@ use nu_engine::command_prelude::*;
use nu_protocol::Signals; use nu_protocol::Signals;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpHead;
impl Command for SubCommand { impl Command for HttpHead {
fn name(&self) -> &str { fn name(&self) -> &str {
"http head" "http head"
} }
@ -175,6 +175,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpHead {})
} }
} }

View File

@ -8,11 +8,11 @@ mod patch;
mod post; mod post;
mod put; mod put;
pub use delete::SubCommand as HttpDelete; pub use delete::HttpDelete;
pub use get::SubCommand as HttpGet; pub use get::HttpGet;
pub use head::SubCommand as HttpHead; pub use head::HttpHead;
pub use http_::Http; pub use http_::Http;
pub use options::SubCommand as HttpOptions; pub use options::HttpOptions;
pub use patch::SubCommand as HttpPatch; pub use patch::HttpPatch;
pub use post::SubCommand as HttpPost; pub use post::HttpPost;
pub use put::SubCommand as HttpPut; pub use put::HttpPut;

View File

@ -7,9 +7,9 @@ use nu_engine::command_prelude::*;
use super::client::HttpBody; use super::client::HttpBody;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpOptions;
impl Command for SubCommand { impl Command for HttpOptions {
fn name(&self) -> &str { fn name(&self) -> &str {
"http options" "http options"
} }
@ -197,6 +197,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpOptions {})
} }
} }

View File

@ -6,9 +6,9 @@ use crate::network::http::client::{
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpPatch;
impl Command for SubCommand { impl Command for HttpPatch {
fn name(&self) -> &str { fn name(&self) -> &str {
"http patch" "http patch"
} }
@ -250,6 +250,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpPatch {})
} }
} }

View File

@ -6,9 +6,9 @@ use crate::network::http::client::{
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpPost;
impl Command for SubCommand { impl Command for HttpPost {
fn name(&self) -> &str { fn name(&self) -> &str {
"http post" "http post"
} }
@ -258,6 +258,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpPost {})
} }
} }

View File

@ -6,9 +6,9 @@ use crate::network::http::client::{
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct HttpPut;
impl Command for SubCommand { impl Command for HttpPut {
fn name(&self) -> &str { fn name(&self) -> &str {
"http put" "http put"
} }
@ -249,6 +249,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(HttpPut {})
} }
} }

View File

@ -11,7 +11,7 @@ pub use self::http::*;
pub use self::url::*; pub use self::url::*;
#[cfg(feature = "network")] #[cfg(feature = "network")]
pub use port::SubCommand as Port; pub use port::Port;
#[cfg(feature = "network")] #[cfg(feature = "network")]
pub use version_check::VersionCheck; pub use version_check::VersionCheck;

View File

@ -4,9 +4,9 @@ use nu_protocol::shell_error::io::IoError;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpListener}; use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpListener};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct Port;
impl Command for SubCommand { impl Command for Port {
fn name(&self) -> &str { fn name(&self) -> &str {
"port" "port"
} }

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use super::query::{record_to_query_string, table_to_query_string}; use super::query::{record_to_query_string, table_to_query_string};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct UrlBuildQuery;
impl Command for SubCommand { impl Command for UrlBuildQuery {
fn name(&self) -> &str { fn name(&self) -> &str {
"url build-query" "url build-query"
} }
@ -90,6 +90,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(UrlBuildQuery {})
} }
} }

View File

@ -4,9 +4,9 @@ use nu_engine::command_prelude::*;
use percent_encoding::percent_decode_str; use percent_encoding::percent_decode_str;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct UrlDecode;
impl Command for SubCommand { impl Command for UrlDecode {
fn name(&self) -> &str { fn name(&self) -> &str {
"url decode" "url decode"
} }
@ -114,6 +114,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(UrlDecode {})
} }
} }

View File

@ -4,9 +4,9 @@ use nu_engine::command_prelude::*;
use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC}; use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct UrlEncode;
impl Command for SubCommand { impl Command for UrlEncode {
fn name(&self) -> &str { fn name(&self) -> &str {
"url encode" "url encode"
} }
@ -130,6 +130,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(UrlEncode {})
} }
} }

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use super::query::{record_to_query_string, table_to_query_string}; use super::query::{record_to_query_string, table_to_query_string};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct UrlJoin;
impl Command for SubCommand { impl Command for UrlJoin {
fn name(&self) -> &str { fn name(&self) -> &str {
"url join" "url join"
} }
@ -378,6 +378,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(UrlJoin {})
} }
} }

View File

@ -7,10 +7,10 @@ mod query;
mod split_query; mod split_query;
mod url_; mod url_;
pub use self::parse::SubCommand as UrlParse; pub use self::parse::UrlParse;
pub use build_query::SubCommand as UrlBuildQuery; pub use build_query::UrlBuildQuery;
pub use decode::SubCommand as UrlDecode; pub use decode::UrlDecode;
pub use encode::SubCommand as UrlEncode; pub use encode::UrlEncode;
pub use join::SubCommand as UrlJoin; pub use join::UrlJoin;
pub use split_query::SubCommand as UrlSplitQuery; pub use split_query::UrlSplitQuery;
pub use url_::Url; pub use url_::Url;

View File

@ -5,9 +5,9 @@ use url::Url;
use super::query::query_string_to_table; use super::query::query_string_to_table;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct UrlParse;
impl Command for SubCommand { impl Command for UrlParse {
fn name(&self) -> &str { fn name(&self) -> &str {
"url parse" "url parse"
} }
@ -128,6 +128,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(UrlParse {})
} }
} }

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use super::query::query_string_to_table; use super::query::query_string_to_table;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct UrlSplitQuery;
impl Command for SubCommand { impl Command for UrlSplitQuery {
fn name(&self) -> &str { fn name(&self) -> &str {
"url split-query" "url split-query"
} }
@ -101,6 +101,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(UrlSplitQuery {})
} }
} }

View File

@ -10,9 +10,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathBasename;
impl Command for SubCommand { impl Command for PathBasename {
fn name(&self) -> &str { fn name(&self) -> &str {
"path basename" "path basename"
} }
@ -156,6 +156,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathBasename {})
} }
} }

View File

@ -11,9 +11,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathDirname;
impl Command for SubCommand { impl Command for PathDirname {
fn name(&self) -> &str { fn name(&self) -> &str {
"path dirname" "path dirname"
} }
@ -194,6 +194,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathDirname {})
} }
} }

View File

@ -13,9 +13,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathExists;
impl Command for SubCommand { impl Command for PathExists {
fn name(&self) -> &str { fn name(&self) -> &str {
"path exists" "path exists"
} }
@ -167,6 +167,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathExists {})
} }
} }

View File

@ -17,9 +17,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathExpand;
impl Command for SubCommand { impl Command for PathExpand {
fn name(&self) -> &str { fn name(&self) -> &str {
"path expand" "path expand"
} }
@ -197,6 +197,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathExpand {})
} }
} }

View File

@ -10,9 +10,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathJoin;
impl Command for SubCommand { impl Command for PathJoin {
fn name(&self) -> &str { fn name(&self) -> &str {
"path join" "path join"
} }
@ -299,6 +299,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathJoin {})
} }
} }

View File

@ -10,17 +10,17 @@ mod self_;
mod split; mod split;
mod r#type; mod r#type;
pub use basename::SubCommand as PathBasename; pub use basename::PathBasename;
pub use dirname::SubCommand as PathDirname; pub use dirname::PathDirname;
pub use exists::SubCommand as PathExists; pub use exists::PathExists;
pub use expand::SubCommand as PathExpand; pub use expand::PathExpand;
pub use join::SubCommand as PathJoin; pub use join::PathJoin;
pub use parse::SubCommand as PathParse; pub use parse::PathParse;
pub use path_::PathCommand as Path; pub use path_::Path;
pub use r#type::SubCommand as PathType; pub use r#type::PathType;
pub use relative_to::SubCommand as PathRelativeTo; pub use relative_to::PathRelativeTo;
pub use self_::SubCommand as PathSelf; pub use self_::PathSelf;
pub use split::SubCommand as PathSplit; pub use split::PathSplit;
use nu_protocol::{ShellError, Span, Value}; use nu_protocol::{ShellError, Span, Value};
use std::path::Path as StdPath; use std::path::Path as StdPath;

View File

@ -10,9 +10,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathParse;
impl Command for SubCommand { impl Command for PathParse {
fn name(&self) -> &str { fn name(&self) -> &str {
"path parse" "path parse"
} }
@ -252,6 +252,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathParse {})
} }
} }

View File

@ -1,9 +1,9 @@
use nu_engine::{command_prelude::*, get_full_help}; use nu_engine::{command_prelude::*, get_full_help};
#[derive(Clone)] #[derive(Clone)]
pub struct PathCommand; pub struct Path;
impl Command for PathCommand { impl Command for Path {
fn name(&self) -> &str { fn name(&self) -> &str {
"path" "path"
} }

View File

@ -11,9 +11,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathRelativeTo;
impl Command for SubCommand { impl Command for PathRelativeTo {
fn name(&self) -> &str { fn name(&self) -> &str {
"path relative-to" "path relative-to"
} }
@ -166,6 +166,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathRelativeTo {})
} }
} }

View File

@ -3,9 +3,9 @@ use nu_path::expand_path_with;
use nu_protocol::{engine::StateWorkingSet, shell_error::io::IoError}; use nu_protocol::{engine::StateWorkingSet, shell_error::io::IoError};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathSelf;
impl Command for SubCommand { impl Command for PathSelf {
fn name(&self) -> &str { fn name(&self) -> &str {
"path self" "path self"
} }
@ -126,6 +126,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathSelf {})
} }
} }

View File

@ -8,9 +8,9 @@ struct Arguments;
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathSplit;
impl Command for SubCommand { impl Command for PathSplit {
fn name(&self) -> &str { fn name(&self) -> &str {
"path split" "path split"
} }
@ -193,6 +193,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathSplit {})
} }
} }

View File

@ -11,9 +11,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {} impl PathSubcommandArguments for Arguments {}
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct PathType;
impl Command for SubCommand { impl Command for PathType {
fn name(&self) -> &str { fn name(&self) -> &str {
"path type" "path type"
} }
@ -147,6 +147,6 @@ mod tests {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(PathType {})
} }
} }

View File

@ -5,7 +5,7 @@ use std::collections::HashMap;
use std::sync::LazyLock; use std::sync::LazyLock;
#[derive(Clone)] #[derive(Clone)]
pub struct AnsiCommand; pub struct Ansi;
struct AnsiCode { struct AnsiCode {
short_name: Option<&'static str>, short_name: Option<&'static str>,
@ -505,7 +505,7 @@ static CODE_LIST: LazyLock<Vec<AnsiCode>> = LazyLock::new(|| { vec![
static CODE_MAP: LazyLock<HashMap<&'static str, &'static str>> = static CODE_MAP: LazyLock<HashMap<&'static str, &'static str>> =
LazyLock::new(|| build_ansi_hashmap(&CODE_LIST)); LazyLock::new(|| build_ansi_hashmap(&CODE_LIST));
impl Command for AnsiCommand { impl Command for Ansi {
fn name(&self) -> &str { fn name(&self) -> &str {
"ansi" "ansi"
} }
@ -902,12 +902,12 @@ fn build_ansi_hashmap(v: &[AnsiCode]) -> HashMap<&str, &str> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::platform::ansi::ansi_::AnsiCommand; use crate::platform::ansi::ansi_::Ansi;
#[test] #[test]
fn examples_work_as_expected() { fn examples_work_as_expected() {
use crate::test_examples; use crate::test_examples;
test_examples(AnsiCommand {}) test_examples(Ansi {})
} }
} }

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*; use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct AnsiLink;
impl Command for SubCommand { impl Command for AnsiLink {
fn name(&self) -> &str { fn name(&self) -> &str {
"ansi link" "ansi link"
} }
@ -144,12 +144,12 @@ fn add_osc_link(text: &str, link: &str) -> String {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::SubCommand; use super::AnsiLink;
#[test] #[test]
fn examples_work_as_expected() { fn examples_work_as_expected() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(AnsiLink {})
} }
} }

View File

@ -2,6 +2,6 @@ mod ansi_;
mod link; mod link;
mod strip; mod strip;
pub use ansi_::AnsiCommand as Ansi; pub use ansi_::Ansi;
pub use link::SubCommand as AnsiLink; pub use link::AnsiLink;
pub use strip::SubCommand as AnsiStrip; pub use strip::AnsiStrip;

View File

@ -16,9 +16,9 @@ impl CmdArgument for Arguments {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct AnsiStrip;
impl Command for SubCommand { impl Command for AnsiStrip {
fn name(&self) -> &str { fn name(&self) -> &str {
"ansi strip" "ansi strip"
} }
@ -83,14 +83,14 @@ fn action(input: &Value, args: &Arguments, _span: Span) -> Value {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{action, Arguments, SubCommand}; use super::{action, AnsiStrip, Arguments};
use nu_protocol::{engine::EngineState, Span, Value}; use nu_protocol::{engine::EngineState, Span, Value};
#[test] #[test]
fn examples_work_as_expected() { fn examples_work_as_expected() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(AnsiStrip {})
} }
#[test] #[test]

View File

@ -2,9 +2,9 @@ use nu_engine::command_prelude::*;
use rand::{thread_rng, RngCore}; use rand::{thread_rng, RngCore};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct RandomBinary;
impl Command for SubCommand { impl Command for RandomBinary {
fn name(&self) -> &str { fn name(&self) -> &str {
"random binary" "random binary"
} }
@ -89,6 +89,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(RandomBinary {})
} }
} }

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use rand::prelude::{thread_rng, Rng}; use rand::prelude::{thread_rng, Rng};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct RandomBool;
impl Command for SubCommand { impl Command for RandomBool {
fn name(&self) -> &str { fn name(&self) -> &str {
"random bool" "random bool"
} }
@ -91,6 +91,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(RandomBool {})
} }
} }

View File

@ -7,9 +7,9 @@ use rand::{
const DEFAULT_CHARS_LENGTH: usize = 25; const DEFAULT_CHARS_LENGTH: usize = 25;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct RandomChars;
impl Command for SubCommand { impl Command for RandomChars {
fn name(&self) -> &str { fn name(&self) -> &str {
"random chars" "random chars"
} }
@ -119,6 +119,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(RandomChars {})
} }
} }

View File

@ -3,9 +3,9 @@ use nu_protocol::ListStream;
use rand::prelude::{thread_rng, Rng}; use rand::prelude::{thread_rng, Rng};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct RandomDice;
impl Command for SubCommand { impl Command for RandomDice {
fn name(&self) -> &str { fn name(&self) -> &str {
"random dice" "random dice"
} }
@ -89,6 +89,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(RandomDice {})
} }
} }

View File

@ -4,9 +4,9 @@ use rand::prelude::{thread_rng, Rng};
use std::ops::Bound; use std::ops::Bound;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct RandomFloat;
impl Command for SubCommand { impl Command for RandomFloat {
fn name(&self) -> &str { fn name(&self) -> &str {
"random float" "random float"
} }
@ -112,6 +112,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(RandomFloat {})
} }
} }

View File

@ -4,9 +4,9 @@ use rand::prelude::{thread_rng, Rng};
use std::ops::Bound; use std::ops::Bound;
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct RandomInt;
impl Command for SubCommand { impl Command for RandomInt {
fn name(&self) -> &str { fn name(&self) -> &str {
"random int" "random int"
} }
@ -124,6 +124,6 @@ mod test {
fn test_examples() { fn test_examples() {
use crate::test_examples; use crate::test_examples;
test_examples(SubCommand {}) test_examples(RandomInt {})
} }
} }

View File

@ -7,11 +7,11 @@ mod int;
mod random_; mod random_;
mod uuid; mod uuid;
pub use self::binary::SubCommand as RandomBinary; pub use self::binary::RandomBinary;
pub use self::bool::SubCommand as RandomBool; pub use self::bool::RandomBool;
pub use self::chars::SubCommand as RandomChars; pub use self::chars::RandomChars;
pub use self::dice::SubCommand as RandomDice; pub use self::dice::RandomDice;
pub use self::float::SubCommand as RandomFloat; pub use self::float::RandomFloat;
pub use self::int::SubCommand as RandomInt; pub use self::int::RandomInt;
pub use self::uuid::SubCommand as RandomUuid; pub use self::uuid::RandomUuid;
pub use random_::RandomCommand as Random; pub use random_::Random;

Some files were not shown because too many files have changed in this diff Show More