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

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

View File

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

View File

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

View File

@ -4,9 +4,9 @@ use nu_protocol::{ast::Expr, Unit};
const NS_PER_SEC: i64 = 1_000_000_000;
#[derive(Clone)]
pub struct SubCommand;
pub struct IntoDuration;
impl Command for SubCommand {
impl Command for IntoDuration {
fn name(&self) -> &str {
"into duration"
}
@ -277,7 +277,7 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(IntoDuration {})
}
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;
#[derive(Clone)]
pub struct SubCommand;
pub struct IntoFilesize;
impl Command for SubCommand {
impl Command for IntoFilesize {
fn name(&self) -> &str {
"into filesize"
}
@ -197,6 +197,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct IntoFloat;
impl Command for SubCommand {
impl Command for IntoFloat {
fn name(&self) -> &str {
"into float"
}
@ -134,7 +134,7 @@ mod tests {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(IntoFloat {})
}
#[test]

View File

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

View File

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

View File

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

View File

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

View File

@ -19,9 +19,9 @@ impl CmdArgument for Arguments {
}
#[derive(Clone)]
pub struct SubCommand;
pub struct IntoString;
impl Command for SubCommand {
impl Command for IntoString {
fn name(&self) -> &str {
"into string"
}
@ -316,6 +316,6 @@ mod test {
fn 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 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};
#[derive(Clone)]
pub struct SubCommand;
pub struct SplitCellPath;
impl Command for SubCommand {
impl Command for SplitCellPath {
fn name(&self) -> &str {
"split cell-path"
}
@ -150,6 +150,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct DateHumanize;
impl Command for SubCommand {
impl Command for DateHumanize {
fn name(&self) -> &str {
"date humanize"
}
@ -101,6 +101,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct DateListTimezones;
impl Command for SubCommand {
impl Command for DateListTimezones {
fn name(&self) -> &str {
"date list-timezone"
}

View File

@ -7,8 +7,8 @@ mod to_timezone;
mod utils;
pub use date_::Date;
pub use humanize::SubCommand as DateHumanize;
pub use list_timezone::SubCommand as DateListTimezones;
pub use now::SubCommand as DateNow;
pub use to_timezone::SubCommand as DateToTimezone;
pub use humanize::DateHumanize;
pub use list_timezone::DateListTimezones;
pub use now::DateNow;
pub use to_timezone::DateToTimezone;
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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct DateNow;
impl Command for SubCommand {
impl Command for DateNow {
fn name(&self) -> &str {
"date now"
}

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathFloor;
impl Command for SubCommand {
impl Command for MathFloor {
fn name(&self) -> &str {
"math floor"
}
@ -103,6 +103,6 @@ mod test {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathLog;
impl Command for SubCommand {
impl Command for MathLog {
fn name(&self) -> &str {
"math log"
}
@ -159,6 +159,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathMax;
impl Command for SubCommand {
impl Command for MathMax {
fn name(&self) -> &str {
"math max"
}
@ -97,6 +97,6 @@ mod test {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathMedian;
impl Command for SubCommand {
impl Command for MathMedian {
fn name(&self) -> &str {
"math median"
}
@ -151,6 +151,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathMin;
impl Command for SubCommand {
impl Command for MathMin {
fn name(&self) -> &str {
"math min"
}
@ -95,6 +95,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathMin {})
}
}

View File

@ -17,20 +17,20 @@ mod sum;
mod utils;
mod variance;
pub use abs::SubCommand as MathAbs;
pub use avg::SubCommand as MathAvg;
pub use ceil::SubCommand as MathCeil;
pub use floor::SubCommand as MathFloor;
pub use abs::MathAbs;
pub use avg::MathAvg;
pub use ceil::MathCeil;
pub use floor::MathFloor;
pub use math_::MathCommand as Math;
pub use max::SubCommand as MathMax;
pub use median::SubCommand as MathMedian;
pub use min::SubCommand as MathMin;
pub use mode::SubCommand as MathMode;
pub use product::SubCommand as MathProduct;
pub use round::SubCommand as MathRound;
pub use sqrt::SubCommand as MathSqrt;
pub use stddev::SubCommand as MathStddev;
pub use sum::SubCommand as MathSum;
pub use variance::SubCommand as MathVariance;
pub use max::MathMax;
pub use median::MathMedian;
pub use min::MathMin;
pub use mode::MathMode;
pub use product::MathProduct;
pub use round::MathRound;
pub use sqrt::MathSqrt;
pub use stddev::MathStddev;
pub use sum::MathSum;
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};
#[derive(Clone)]
pub struct SubCommand;
pub struct MathMode;
#[derive(Hash, Eq, PartialEq, Debug)]
enum NumberTypes {
@ -28,7 +28,7 @@ impl HashableType {
}
}
impl Command for SubCommand {
impl Command for MathMode {
fn name(&self) -> &str {
"math mode"
}
@ -183,6 +183,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathProduct;
impl Command for SubCommand {
impl Command for MathProduct {
fn name(&self) -> &str {
"math product"
}
@ -88,6 +88,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(MathProduct {})
}
}

View File

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

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathSqrt;
impl Command for SubCommand {
impl Command for MathSqrt {
fn name(&self) -> &str {
"math sqrt"
}
@ -127,6 +127,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathStddev;
impl Command for SubCommand {
impl Command for MathStddev {
fn name(&self) -> &str {
"math stddev"
}
@ -111,6 +111,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathSum;
impl Command for SubCommand {
impl Command for MathSum {
fn name(&self) -> &str {
"math sum"
}
@ -94,6 +94,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct MathVariance;
impl Command for SubCommand {
impl Command for MathVariance {
fn name(&self) -> &str {
"math variance"
}
@ -135,6 +135,6 @@ mod test {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpDelete;
impl Command for SubCommand {
impl Command for HttpDelete {
fn name(&self) -> &str {
"http delete"
}
@ -248,6 +248,6 @@ mod tests {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpGet;
impl Command for SubCommand {
impl Command for HttpGet {
fn name(&self) -> &str {
"http get"
}
@ -216,6 +216,6 @@ mod tests {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpHead;
impl Command for SubCommand {
impl Command for HttpHead {
fn name(&self) -> &str {
"http head"
}
@ -175,6 +175,6 @@ mod tests {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(HttpHead {})
}
}

View File

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

View File

@ -7,9 +7,9 @@ use nu_engine::command_prelude::*;
use super::client::HttpBody;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpOptions;
impl Command for SubCommand {
impl Command for HttpOptions {
fn name(&self) -> &str {
"http options"
}
@ -197,6 +197,6 @@ mod tests {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpPatch;
impl Command for SubCommand {
impl Command for HttpPatch {
fn name(&self) -> &str {
"http patch"
}
@ -250,6 +250,6 @@ mod tests {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpPost;
impl Command for SubCommand {
impl Command for HttpPost {
fn name(&self) -> &str {
"http post"
}
@ -258,6 +258,6 @@ mod tests {
fn 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::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct HttpPut;
impl Command for SubCommand {
impl Command for HttpPut {
fn name(&self) -> &str {
"http put"
}
@ -249,6 +249,6 @@ mod tests {
fn 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::*;
#[cfg(feature = "network")]
pub use port::SubCommand as Port;
pub use port::Port;
#[cfg(feature = "network")]
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};
#[derive(Clone)]
pub struct SubCommand;
pub struct Port;
impl Command for SubCommand {
impl Command for Port {
fn name(&self) -> &str {
"port"
}

View File

@ -3,9 +3,9 @@ use nu_engine::command_prelude::*;
use super::query::{record_to_query_string, table_to_query_string};
#[derive(Clone)]
pub struct SubCommand;
pub struct UrlBuildQuery;
impl Command for SubCommand {
impl Command for UrlBuildQuery {
fn name(&self) -> &str {
"url build-query"
}
@ -90,6 +90,6 @@ mod test {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct UrlDecode;
impl Command for SubCommand {
impl Command for UrlDecode {
fn name(&self) -> &str {
"url decode"
}
@ -114,6 +114,6 @@ mod test {
fn 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};
#[derive(Clone)]
pub struct SubCommand;
pub struct UrlEncode;
impl Command for SubCommand {
impl Command for UrlEncode {
fn name(&self) -> &str {
"url encode"
}
@ -130,6 +130,6 @@ mod test {
fn 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};
#[derive(Clone)]
pub struct SubCommand;
pub struct UrlJoin;
impl Command for SubCommand {
impl Command for UrlJoin {
fn name(&self) -> &str {
"url join"
}
@ -378,6 +378,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(UrlJoin {})
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,9 +10,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {}
#[derive(Clone)]
pub struct SubCommand;
pub struct PathParse;
impl Command for SubCommand {
impl Command for PathParse {
fn name(&self) -> &str {
"path parse"
}
@ -252,6 +252,6 @@ mod tests {
fn 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};
#[derive(Clone)]
pub struct PathCommand;
pub struct Path;
impl Command for PathCommand {
impl Command for Path {
fn name(&self) -> &str {
"path"
}

View File

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

View File

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

View File

@ -11,9 +11,9 @@ struct Arguments {
impl PathSubcommandArguments for Arguments {}
#[derive(Clone)]
pub struct SubCommand;
pub struct PathType;
impl Command for SubCommand {
impl Command for PathType {
fn name(&self) -> &str {
"path type"
}
@ -147,6 +147,6 @@ mod tests {
fn 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;
#[derive(Clone)]
pub struct AnsiCommand;
pub struct Ansi;
struct AnsiCode {
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>> =
LazyLock::new(|| build_ansi_hashmap(&CODE_LIST));
impl Command for AnsiCommand {
impl Command for Ansi {
fn name(&self) -> &str {
"ansi"
}
@ -902,12 +902,12 @@ fn build_ansi_hashmap(v: &[AnsiCode]) -> HashMap<&str, &str> {
#[cfg(test)]
mod tests {
use crate::platform::ansi::ansi_::AnsiCommand;
use crate::platform::ansi::ansi_::Ansi;
#[test]
fn examples_work_as_expected() {
use crate::test_examples;
test_examples(AnsiCommand {})
test_examples(Ansi {})
}
}

View File

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

View File

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

View File

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

View File

@ -2,9 +2,9 @@ use nu_engine::command_prelude::*;
use rand::{thread_rng, RngCore};
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomBinary;
impl Command for SubCommand {
impl Command for RandomBinary {
fn name(&self) -> &str {
"random binary"
}
@ -89,6 +89,6 @@ mod test {
fn 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};
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomBool;
impl Command for SubCommand {
impl Command for RandomBool {
fn name(&self) -> &str {
"random bool"
}
@ -91,6 +91,6 @@ mod test {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomChars;
impl Command for SubCommand {
impl Command for RandomChars {
fn name(&self) -> &str {
"random chars"
}
@ -119,6 +119,6 @@ mod test {
fn 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};
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomDice;
impl Command for SubCommand {
impl Command for RandomDice {
fn name(&self) -> &str {
"random dice"
}
@ -89,6 +89,6 @@ mod test {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomFloat;
impl Command for SubCommand {
impl Command for RandomFloat {
fn name(&self) -> &str {
"random float"
}
@ -112,6 +112,6 @@ mod test {
fn 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;
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomInt;
impl Command for SubCommand {
impl Command for RandomInt {
fn name(&self) -> &str {
"random int"
}
@ -124,6 +124,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(RandomInt {})
}
}

View File

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

View File

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

View File

@ -2,9 +2,9 @@ use nu_engine::command_prelude::*;
use uuid::{Timestamp, Uuid};
#[derive(Clone)]
pub struct SubCommand;
pub struct RandomUuid;
impl Command for SubCommand {
impl Command for RandomUuid {
fn name(&self) -> &str {
"random uuid"
}
@ -333,6 +333,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(RandomUuid {})
}
}

View File

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

View File

@ -2,6 +2,6 @@ mod format;
mod let_env;
mod removed_commands;
pub use format::SubCommand as DateFormat;
pub use format::DateFormat;
pub use let_env::LetEnv;
pub use removed_commands::*;

View File

@ -4,9 +4,9 @@ use nu_engine::command_prelude::*;
use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)]
pub struct SubCommand;
pub struct SplitChars;
impl Command for SubCommand {
impl Command for SplitChars {
fn name(&self) -> &str {
"split chars"
}
@ -173,6 +173,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(SplitChars {})
}
}

View File

@ -2,9 +2,9 @@ use fancy_regex::{escape, Regex};
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct SplitColumn;
impl Command for SubCommand {
impl Command for SplitColumn {
fn name(&self) -> &str {
"split column"
}
@ -275,6 +275,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(SplitColumn {})
}
}

View File

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

View File

@ -5,9 +5,9 @@ mod list;
mod row;
mod words;
pub use chars::SubCommand as SplitChars;
pub use column::SubCommand as SplitColumn;
pub use command::SplitCommand as Split;
pub use chars::SplitChars;
pub use column::SplitColumn;
pub use command::Split;
pub use list::SubCommand as SplitList;
pub use row::SubCommand as SplitRow;
pub use words::SubCommand as SplitWords;
pub use row::SplitRow;
pub use words::SplitWords;

View File

@ -2,9 +2,9 @@ use fancy_regex::{escape, Regex};
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct SplitRow;
impl Command for SubCommand {
impl Command for SplitRow {
fn name(&self) -> &str {
"split row"
}
@ -239,6 +239,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(SplitRow {})
}
}

View File

@ -5,9 +5,9 @@ use nu_engine::command_prelude::*;
use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)]
pub struct SubCommand;
pub struct SplitWords;
impl Command for SubCommand {
impl Command for SplitWords {
fn name(&self) -> &str {
"split words"
}
@ -420,7 +420,7 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(SplitWords {})
}
#[test]
fn mixed_letter_number() {

View File

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

View File

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

View File

@ -3,10 +3,10 @@ mod downcase;
mod str_;
mod upcase;
pub use capitalize::SubCommand as StrCapitalize;
pub use downcase::SubCommand as StrDowncase;
pub use capitalize::StrCapitalize;
pub use downcase::StrDowncase;
pub use str_::Str;
pub use upcase::SubCommand as StrUpcase;
pub use upcase::StrUpcase;
use nu_cmd_base::input_handler::{operate as general_operate, CmdArgument};
use nu_engine::command_prelude::*;

View File

@ -1,9 +1,9 @@
use nu_engine::command_prelude::*;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrUpcase;
impl Command for SubCommand {
impl Command for StrUpcase {
fn name(&self) -> &str {
"str upcase"
}
@ -116,13 +116,13 @@ fn action(input: &Value, head: Span) -> Value {
#[cfg(test)]
mod tests {
use super::*;
use super::{action, SubCommand};
use super::{action, StrUpcase};
#[test]
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrUpcase {})
}
#[test]

View File

@ -4,7 +4,7 @@ use nu_engine::command_prelude::*;
use nu_utils::IgnoreCaseExt;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrContains;
struct Arguments {
substring: String,
@ -18,7 +18,7 @@ impl CmdArgument for Arguments {
}
}
impl Command for SubCommand {
impl Command for StrContains {
fn name(&self) -> &str {
"str contains"
}
@ -187,6 +187,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrContains {})
}
}

View File

@ -3,7 +3,7 @@ use nu_engine::command_prelude::*;
use nu_protocol::{engine::StateWorkingSet, levenshtein_distance};
#[derive(Clone)]
pub struct SubCommand;
pub struct StrDistance;
struct Arguments {
compare_string: String,
@ -16,7 +16,7 @@ impl CmdArgument for Arguments {
}
}
impl Command for SubCommand {
impl Command for StrDistance {
fn name(&self) -> &str {
"str distance"
}
@ -148,6 +148,6 @@ mod tests {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrDistance {})
}
}

View File

@ -16,9 +16,9 @@ impl CmdArgument for Arguments {
}
#[derive(Clone)]
pub struct SubCommand;
pub struct StrEndswith;
impl Command for SubCommand {
impl Command for StrEndswith {
fn name(&self) -> &str {
"str ends-with"
}
@ -149,6 +149,6 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrEndswith {})
}
}

View File

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

View File

@ -21,9 +21,9 @@ impl CmdArgument for Arguments {
}
#[derive(Clone)]
pub struct SubCommand;
pub struct StrIndexOf;
impl Command for SubCommand {
impl Command for StrIndexOf {
fn name(&self) -> &str {
"str index-of"
}
@ -246,13 +246,13 @@ mod tests {
use nu_protocol::ast::RangeInclusion;
use super::*;
use super::{action, Arguments, SubCommand};
use super::{action, Arguments, StrIndexOf};
#[test]
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrIndexOf {})
}
#[test]

View File

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

View File

@ -14,16 +14,16 @@ mod substring;
mod trim;
pub use case::*;
pub use contains::SubCommand as StrContains;
pub use distance::SubCommand as StrDistance;
pub use ends_with::SubCommand as StrEndswith;
pub use expand::SubCommand as StrExpand;
pub use index_of::SubCommand as StrIndexOf;
pub use contains::StrContains;
pub use distance::StrDistance;
pub use ends_with::StrEndswith;
pub use expand::StrExpand;
pub use index_of::StrIndexOf;
pub use join::*;
pub use length::SubCommand as StrLength;
pub use replace::SubCommand as StrReplace;
pub use reverse::SubCommand as StrReverse;
pub use starts_with::SubCommand as StrStartsWith;
pub use stats::SubCommand as StrStats;
pub use substring::SubCommand as StrSubstring;
pub use trim::Trim as StrTrim;
pub use length::StrLength;
pub use replace::StrReplace;
pub use reverse::StrReverse;
pub use starts_with::StrStartsWith;
pub use stats::StrStats;
pub use substring::StrSubstring;
pub use trim::StrTrim;

View File

@ -19,9 +19,9 @@ impl CmdArgument for Arguments {
}
#[derive(Clone)]
pub struct SubCommand;
pub struct StrReplace;
impl Command for SubCommand {
impl Command for StrReplace {
fn name(&self) -> &str {
"str replace"
}
@ -304,7 +304,7 @@ fn action(
#[cfg(test)]
mod tests {
use super::*;
use super::{action, Arguments, SubCommand};
use super::{action, Arguments, StrReplace};
fn test_spanned_string(val: &str) -> Spanned<String> {
Spanned {
@ -317,7 +317,7 @@ mod tests {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrReplace {})
}
#[test]

View File

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

View File

@ -17,9 +17,9 @@ impl CmdArgument for Arguments {
#[derive(Clone)]
pub struct SubCommand;
pub struct StrStartsWith;
impl Command for SubCommand {
impl Command for StrStartsWith {
fn name(&self) -> &str {
"str starts-with"
}
@ -161,6 +161,6 @@ mod tests {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrStartsWith {})
}
}

View File

@ -9,9 +9,9 @@ use unicode_segmentation::UnicodeSegmentation;
pub type Counted = BTreeMap<Counter, usize>;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrStats;
impl Command for SubCommand {
impl Command for StrStats {
fn name(&self) -> &str {
"str stats"
}
@ -293,7 +293,7 @@ mod test {
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrStats {})
}
}

View File

@ -7,7 +7,7 @@ use nu_protocol::{engine::StateWorkingSet, IntRange};
use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)]
pub struct SubCommand;
pub struct StrSubstring;
struct Arguments {
range: IntRange,
@ -21,7 +21,7 @@ impl CmdArgument for Arguments {
}
}
impl Command for SubCommand {
impl Command for StrSubstring {
fn name(&self) -> &str {
"str substring"
}
@ -188,13 +188,13 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
mod tests {
use nu_protocol::IntRange;
use super::{action, Arguments, Span, SubCommand, Value};
use super::{action, Arguments, Span, StrSubstring, Value};
#[test]
fn test_examples() {
use crate::test_examples;
test_examples(SubCommand {})
test_examples(StrSubstring {})
}
#[derive(Clone, Copy, Debug)]

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