diff --git a/crates/nu-cmd-extra/src/extra/bits/not.rs b/crates/nu-cmd-extra/src/extra/bits/not.rs index 3e4e72529c..851458f95a 100644 --- a/crates/nu-cmd-extra/src/extra/bits/not.rs +++ b/crates/nu-cmd-extra/src/extra/bits/not.rs @@ -24,6 +24,7 @@ impl Command for BitsNot { ), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .switch( "signed", "always treat input number as a signed number", diff --git a/crates/nu-cmd-extra/src/extra/bytes/add.rs b/crates/nu-cmd-extra/src/extra/bytes/add.rs index 70f36069c3..00c9a960f4 100644 --- a/crates/nu-cmd-extra/src/extra/bytes/add.rs +++ b/crates/nu-cmd-extra/src/extra/bytes/add.rs @@ -30,8 +30,15 @@ impl Command for BytesAdd { fn signature(&self) -> Signature { Signature::build("bytes add") - .input_output_types(vec![(Type::Binary, Type::Binary)]) + .input_output_types(vec![ + (Type::Binary, Type::Binary), + ( + Type::List(Box::new(Type::Binary)), + Type::List(Box::new(Type::Binary)), + ), + ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .required("data", SyntaxShape::Binary, "the binary to add") .named( "index", diff --git a/crates/nu-cmd-extra/src/extra/bytes/at.rs b/crates/nu-cmd-extra/src/extra/bytes/at.rs index c8c6c3b39a..0e83d27126 100644 --- a/crates/nu-cmd-extra/src/extra/bytes/at.rs +++ b/crates/nu-cmd-extra/src/extra/bytes/at.rs @@ -37,7 +37,13 @@ impl Command for BytesAt { fn signature(&self) -> Signature { Signature::build("bytes at") - .input_output_types(vec![(Type::Binary, Type::Binary)]) + .input_output_types(vec![ + (Type::Binary, Type::Binary), + ( + Type::List(Box::new(Type::Binary)), + Type::List(Box::new(Type::Binary)), + ), + ]) .vectorizes_over_list(true) .required("range", SyntaxShape::Range, "the range to get bytes") .rest( diff --git a/crates/nu-cmd-extra/src/extra/math/arccos.rs b/crates/nu-cmd-extra/src/extra/math/arccos.rs index 959e1a648a..7be63d6a52 100644 --- a/crates/nu-cmd-extra/src/extra/math/arccos.rs +++ b/crates/nu-cmd-extra/src/extra/math/arccos.rs @@ -13,7 +13,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math arccos") .switch("degrees", "Return degrees instead of radians", Some('d')) - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/arccosh.rs b/crates/nu-cmd-extra/src/extra/math/arccosh.rs index 92af886f23..277a76dcd7 100644 --- a/crates/nu-cmd-extra/src/extra/math/arccosh.rs +++ b/crates/nu-cmd-extra/src/extra/math/arccosh.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math arccosh") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/arcsin.rs b/crates/nu-cmd-extra/src/extra/math/arcsin.rs index aa588b1a87..501793c63e 100644 --- a/crates/nu-cmd-extra/src/extra/math/arcsin.rs +++ b/crates/nu-cmd-extra/src/extra/math/arcsin.rs @@ -13,7 +13,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math arcsin") .switch("degrees", "Return degrees instead of radians", Some('d')) - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/arcsinh.rs b/crates/nu-cmd-extra/src/extra/math/arcsinh.rs index dfc2b68be5..719671e48d 100644 --- a/crates/nu-cmd-extra/src/extra/math/arcsinh.rs +++ b/crates/nu-cmd-extra/src/extra/math/arcsinh.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math arcsinh") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/arctan.rs b/crates/nu-cmd-extra/src/extra/math/arctan.rs index 8cf1de39a9..284a6b8a5f 100644 --- a/crates/nu-cmd-extra/src/extra/math/arctan.rs +++ b/crates/nu-cmd-extra/src/extra/math/arctan.rs @@ -13,7 +13,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math arctan") .switch("degrees", "Return degrees instead of radians", Some('d')) - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/arctanh.rs b/crates/nu-cmd-extra/src/extra/math/arctanh.rs index 1e8549b581..716cf8e339 100644 --- a/crates/nu-cmd-extra/src/extra/math/arctanh.rs +++ b/crates/nu-cmd-extra/src/extra/math/arctanh.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math arctanh") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/cosh.rs b/crates/nu-cmd-extra/src/extra/math/cosh.rs index 1605cd07b7..23f4d72b87 100644 --- a/crates/nu-cmd-extra/src/extra/math/cosh.rs +++ b/crates/nu-cmd-extra/src/extra/math/cosh.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math cosh") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/exp.rs b/crates/nu-cmd-extra/src/extra/math/exp.rs index d376e782e1..75fb15646d 100644 --- a/crates/nu-cmd-extra/src/extra/math/exp.rs +++ b/crates/nu-cmd-extra/src/extra/math/exp.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math exp") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/ln.rs b/crates/nu-cmd-extra/src/extra/math/ln.rs index 305beb057c..d93e94080d 100644 --- a/crates/nu-cmd-extra/src/extra/math/ln.rs +++ b/crates/nu-cmd-extra/src/extra/math/ln.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math ln") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/sinh.rs b/crates/nu-cmd-extra/src/extra/math/sinh.rs index af63301163..24a7551724 100644 --- a/crates/nu-cmd-extra/src/extra/math/sinh.rs +++ b/crates/nu-cmd-extra/src/extra/math/sinh.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math sinh") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/math/tanh.rs b/crates/nu-cmd-extra/src/extra/math/tanh.rs index 0c24bdd248..2f4f99cbfc 100644 --- a/crates/nu-cmd-extra/src/extra/math/tanh.rs +++ b/crates/nu-cmd-extra/src/extra/math/tanh.rs @@ -12,7 +12,14 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math tanh") - .input_output_types(vec![(Type::Number, Type::Float)]) + .input_output_types(vec![ + (Type::Number, Type::Float), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .category(Category::Math) } diff --git a/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs b/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs index ae341c0cab..33bbd91545 100644 --- a/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs +++ b/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs @@ -46,6 +46,10 @@ impl Command for SubCommand { ) .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) diff --git a/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs b/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs index a0529ad18c..61cd1b5d40 100644 --- a/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs +++ b/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs @@ -15,7 +15,14 @@ impl Command for DecodeHex { fn signature(&self) -> Signature { Signature::build("decode hex") - .input_output_types(vec![(Type::String, Type::Binary)]) + .input_output_types(vec![ + (Type::String, Type::Binary), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::Binary)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .rest( "rest", diff --git a/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs b/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs index d4974ea83f..13158bcfc7 100644 --- a/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs +++ b/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs @@ -15,7 +15,14 @@ impl Command for EncodeHex { fn signature(&self) -> Signature { Signature::build("encode hex") - .input_output_types(vec![(Type::Binary, Type::String)]) + .input_output_types(vec![ + (Type::Binary, Type::String), + ( + Type::List(Box::new(Type::Binary)), + Type::List(Box::new(Type::String)), + ), + ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .rest( "rest", diff --git a/crates/nu-command/src/conversions/fill.rs b/crates/nu-command/src/conversions/fill.rs index 156c3fe201..4572621d42 100644 --- a/crates/nu-command/src/conversions/fill.rs +++ b/crates/nu-command/src/conversions/fill.rs @@ -47,8 +47,15 @@ impl Command for Fill { (Type::Float, Type::String), (Type::String, Type::String), (Type::Filesize, Type::String), + (Type::List(Box::new(Type::Int)), Type::List(Box::new(Type::String))), + (Type::List(Box::new(Type::Float)), Type::List(Box::new(Type::String))), + (Type::List(Box::new(Type::String)), Type::List(Box::new(Type::String))), + (Type::List(Box::new(Type::Filesize)), Type::List(Box::new(Type::String))), + // General case for heterogeneous lists + (Type::List(Box::new(Type::Any)), Type::List(Box::new(Type::String))), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .named( "width", SyntaxShape::Int, diff --git a/crates/nu-command/src/conversions/into/filesize.rs b/crates/nu-command/src/conversions/into/filesize.rs index 071900e42a..7c6f0d6a51 100644 --- a/crates/nu-command/src/conversions/into/filesize.rs +++ b/crates/nu-command/src/conversions/into/filesize.rs @@ -22,7 +22,29 @@ impl Command for SubCommand { (Type::String, Type::Filesize), (Type::Filesize, Type::Filesize), (Type::Table(vec![]), Type::Table(vec![])), + ( + Type::List(Box::new(Type::Int)), + Type::List(Box::new(Type::Filesize)), + ), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Filesize)), + ), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::Filesize)), + ), + ( + Type::List(Box::new(Type::Filesize)), + Type::List(Box::new(Type::Filesize)), + ), + // Catch all for heterogeneous lists. + ( + Type::List(Box::new(Type::Any)), + Type::List(Box::new(Type::Filesize)), + ), ]) + .allow_variants_without_examples(true) .vectorizes_over_list(true) .rest( "rest", diff --git a/crates/nu-command/src/math/round.rs b/crates/nu-command/src/math/round.rs index b595688e11..aee5f54c2f 100644 --- a/crates/nu-command/src/math/round.rs +++ b/crates/nu-command/src/math/round.rs @@ -23,6 +23,7 @@ impl Command for SubCommand { ), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .named( "precision", SyntaxShape::Number, diff --git a/crates/nu-command/src/strings/encode_decode/decode_base64.rs b/crates/nu-command/src/strings/encode_decode/decode_base64.rs index 8bf6804ffc..b255d09ece 100644 --- a/crates/nu-command/src/strings/encode_decode/decode_base64.rs +++ b/crates/nu-command/src/strings/encode_decode/decode_base64.rs @@ -18,8 +18,17 @@ impl Command for DecodeBase64 { .input_output_types(vec![ (Type::String, Type::String), (Type::String, Type::Binary), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::Binary)), + ), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .named( "character-set", SyntaxShape::String, diff --git a/crates/nu-command/src/strings/encode_decode/encode_base64.rs b/crates/nu-command/src/strings/encode_decode/encode_base64.rs index 6ba4d5b59a..fd06cede59 100644 --- a/crates/nu-command/src/strings/encode_decode/encode_base64.rs +++ b/crates/nu-command/src/strings/encode_decode/encode_base64.rs @@ -18,8 +18,23 @@ impl Command for EncodeBase64 { .input_output_types(vec![ (Type::String, Type::String), (Type::Binary, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), + ( + Type::List(Box::new(Type::Binary)), + Type::List(Box::new(Type::String)), + ), + // Relaxed for heterogeneous list. + // Should be removed as soon as the type system supports better restrictions + ( + Type::List(Box::new(Type::Any)), + Type::List(Box::new(Type::String)), + ), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .named( "character-set", SyntaxShape::String, diff --git a/crates/nu-command/src/strings/str_/case/camel_case.rs b/crates/nu-command/src/strings/str_/case/camel_case.rs index cee3e1993e..78cc2dc4e3 100644 --- a/crates/nu-command/src/strings/str_/case/camel_case.rs +++ b/crates/nu-command/src/strings/str_/case/camel_case.rs @@ -19,9 +19,14 @@ impl Command for SubCommand { Signature::build("str camel-case") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/capitalize.rs b/crates/nu-command/src/strings/str_/case/capitalize.rs index bad3ddb720..87ba979d74 100644 --- a/crates/nu-command/src/strings/str_/case/capitalize.rs +++ b/crates/nu-command/src/strings/str_/case/capitalize.rs @@ -17,9 +17,14 @@ impl Command for SubCommand { Signature::build("str capitalize") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/downcase.rs b/crates/nu-command/src/strings/str_/case/downcase.rs index df16626f4b..2bd7df1c17 100644 --- a/crates/nu-command/src/strings/str_/case/downcase.rs +++ b/crates/nu-command/src/strings/str_/case/downcase.rs @@ -17,9 +17,14 @@ impl Command for SubCommand { Signature::build("str downcase") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/kebab_case.rs b/crates/nu-command/src/strings/str_/case/kebab_case.rs index f807862e85..f05fdb3aec 100644 --- a/crates/nu-command/src/strings/str_/case/kebab_case.rs +++ b/crates/nu-command/src/strings/str_/case/kebab_case.rs @@ -20,8 +20,13 @@ impl Command for SubCommand { .input_output_types(vec![ (Type::String, Type::String), (Type::Table(vec![]), Type::Table(vec![])), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/pascal_case.rs b/crates/nu-command/src/strings/str_/case/pascal_case.rs index 459dde3db1..1220c27832 100644 --- a/crates/nu-command/src/strings/str_/case/pascal_case.rs +++ b/crates/nu-command/src/strings/str_/case/pascal_case.rs @@ -20,8 +20,13 @@ impl Command for SubCommand { .input_output_types(vec![ (Type::String, Type::String), (Type::Table(vec![]), Type::Table(vec![])), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/screaming_snake_case.rs b/crates/nu-command/src/strings/str_/case/screaming_snake_case.rs index 840fce560c..3da90a4288 100644 --- a/crates/nu-command/src/strings/str_/case/screaming_snake_case.rs +++ b/crates/nu-command/src/strings/str_/case/screaming_snake_case.rs @@ -18,9 +18,14 @@ impl Command for SubCommand { Signature::build("str screaming-snake-case") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/snake_case.rs b/crates/nu-command/src/strings/str_/case/snake_case.rs index 56e7bb2b09..cbf7d71a1c 100644 --- a/crates/nu-command/src/strings/str_/case/snake_case.rs +++ b/crates/nu-command/src/strings/str_/case/snake_case.rs @@ -18,9 +18,14 @@ impl Command for SubCommand { Signature::build("str snake-case") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/title_case.rs b/crates/nu-command/src/strings/str_/case/title_case.rs index daab6fd47d..453f914c91 100644 --- a/crates/nu-command/src/strings/str_/case/title_case.rs +++ b/crates/nu-command/src/strings/str_/case/title_case.rs @@ -19,9 +19,14 @@ impl Command for SubCommand { Signature::build("str title-case") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .rest( "rest", SyntaxShape::CellPath, diff --git a/crates/nu-command/src/strings/str_/case/upcase.rs b/crates/nu-command/src/strings/str_/case/upcase.rs index 259026f56b..b70adb8d61 100644 --- a/crates/nu-command/src/strings/str_/case/upcase.rs +++ b/crates/nu-command/src/strings/str_/case/upcase.rs @@ -16,6 +16,10 @@ impl Command for SubCommand { Signature::build("str upcase") .input_output_types(vec![ (Type::String, Type::String), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::String)), + ), (Type::Table(vec![]), Type::Table(vec![])), ]) .vectorizes_over_list(true) diff --git a/crates/nu-command/src/strings/str_/contains.rs b/crates/nu-command/src/strings/str_/contains.rs index 5d5a7db102..5cbae64383 100644 --- a/crates/nu-command/src/strings/str_/contains.rs +++ b/crates/nu-command/src/strings/str_/contains.rs @@ -31,6 +31,7 @@ impl Command for SubCommand { Signature::build("str contains") .input_output_types(vec![ (Type::String, Type::Bool), + // TODO figure out cell-path type behavior (Type::Table(vec![]), Type::Table(vec![])), (Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool))) ]) diff --git a/crates/nu-command/src/strings/str_/ends_with.rs b/crates/nu-command/src/strings/str_/ends_with.rs index 4d8ebb2643..97d0b5bfb4 100644 --- a/crates/nu-command/src/strings/str_/ends_with.rs +++ b/crates/nu-command/src/strings/str_/ends_with.rs @@ -28,7 +28,10 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("str ends-with") - .input_output_types(vec![(Type::String, Type::Bool)]) + .input_output_types(vec![ + (Type::String, Type::Bool), + (Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool))), + ]) .vectorizes_over_list(true) .required("string", SyntaxShape::String, "the string to match") .rest( @@ -73,9 +76,12 @@ impl Command for SubCommand { result: Some(Value::test_bool(true)), }, Example { - description: "Checks if string ends with '.txt'", - example: "'my_library.rb' | str ends-with '.txt'", - result: Some(Value::test_bool(false)), + description: "Checks if strings end with '.txt'", + example: "['my_library.rb', 'README.txt'] | str ends-with '.txt'", + result: Some(Value::test_list(vec![ + Value::test_bool(false), + Value::test_bool(true), + ])), }, Example { description: "Checks if string ends with '.RB', case-insensitive", diff --git a/crates/nu-command/src/strings/str_/expand.rs b/crates/nu-command/src/strings/str_/expand.rs index 5b2e084dad..15a6d2c731 100644 --- a/crates/nu-command/src/strings/str_/expand.rs +++ b/crates/nu-command/src/strings/str_/expand.rs @@ -22,8 +22,15 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("str expand") - .input_output_types(vec![(Type::String, Type::List(Box::new(Type::String)))]) + .input_output_types(vec![ + (Type::String, Type::List(Box::new(Type::String))), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::List(Box::new(Type::String)))), + ), + ]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .category(Category::Strings) } diff --git a/crates/nu-command/src/strings/str_/index_of.rs b/crates/nu-command/src/strings/str_/index_of.rs index 86d0d3bac4..1bd50bfdae 100644 --- a/crates/nu-command/src/strings/str_/index_of.rs +++ b/crates/nu-command/src/strings/str_/index_of.rs @@ -37,8 +37,9 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("str index-of") - .input_output_types(vec![(Type::String, Type::Int)]) + .input_output_types(vec![(Type::String, Type::Int),(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Int)))]) .vectorizes_over_list(true) // TODO: no test coverage + .allow_variants_without_examples(true) .required("string", SyntaxShape::String, "the string to find in the input") .switch( "grapheme-clusters", diff --git a/crates/nu-command/src/strings/str_/replace.rs b/crates/nu-command/src/strings/str_/replace.rs index ed2dfcdfb0..57e72f9b0f 100644 --- a/crates/nu-command/src/strings/str_/replace.rs +++ b/crates/nu-command/src/strings/str_/replace.rs @@ -36,6 +36,7 @@ impl Command for SubCommand { Signature::build("str replace") .input_output_types(vec![ (Type::String, Type::String), + // TODO: clarify behavior with cellpath-rest argument (Type::Table(vec![]), Type::Table(vec![])), ( Type::List(Box::new(Type::String)), diff --git a/crates/nu-command/src/strings/str_/starts_with.rs b/crates/nu-command/src/strings/str_/starts_with.rs index 0c8c3cdd00..e0fc1e77c7 100644 --- a/crates/nu-command/src/strings/str_/starts_with.rs +++ b/crates/nu-command/src/strings/str_/starts_with.rs @@ -30,8 +30,9 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("str starts-with") - .input_output_types(vec![(Type::String, Type::Bool)]) + .input_output_types(vec![(Type::String, Type::Bool),(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool)))]) .vectorizes_over_list(true) + .allow_variants_without_examples(true) .required("string", SyntaxShape::String, "the string to match") .rest( "rest", diff --git a/crates/nu-command/src/strings/str_/substring.rs b/crates/nu-command/src/strings/str_/substring.rs index 6079f64cc6..e252b19d2f 100644 --- a/crates/nu-command/src/strings/str_/substring.rs +++ b/crates/nu-command/src/strings/str_/substring.rs @@ -42,7 +42,7 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("str substring") - .input_output_types(vec![(Type::String, Type::String), (Type::Table(vec![]), Type::Table(vec![]))]) + .input_output_types(vec![(Type::String, Type::String), (Type::List(Box::new(Type::String)), Type::List(Box::new(Type::String))), (Type::Table(vec![]), Type::Table(vec![]))]) .vectorizes_over_list(true) .allow_variants_without_examples(true) .switch(