mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Adjust signatures for cellpath access of tables (#9778)
# Description Reallow the commands that take cellpaths as rest parameters to operate on table input data. Went through all commands returned by ``` scope commands | filter { |cmd| $cmd.signatures | values | any {|sig| $sig | any {|$sig| $sig.parameter_type == rest and $sig.syntax_shape == cellpath } } } | get name ``` Only exception to that was `is-empty` that returns a bool. # User-Facing Changes Same table operations as in `0.82` should still be possible Mitigates effects of #9680
This commit is contained in:
committed by
GitHub
parent
d7ebe5fdc3
commit
9db0d6bd34
@ -26,6 +26,7 @@ impl Command for DecodeBase64 {
|
||||
Type::List(Box::new(Type::String)),
|
||||
Type::List(Box::new(Type::Binary)),
|
||||
),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
|
@ -32,6 +32,7 @@ impl Command for EncodeBase64 {
|
||||
Type::List(Box::new(Type::Any)),
|
||||
Type::List(Box::new(Type::String)),
|
||||
),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
|
@ -31,7 +31,9 @@ impl Command for SubCommand {
|
||||
.input_output_types(vec![
|
||||
(Type::String, Type::Bool),
|
||||
(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool))),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.required("string", SyntaxShape::String, "the string to match")
|
||||
.rest(
|
||||
|
@ -37,7 +37,11 @@ impl Command for SubCommand {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("str index-of")
|
||||
.input_output_types(vec![(Type::String, Type::Int),(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Int)))])
|
||||
.input_output_types(vec![
|
||||
(Type::String, Type::Int),
|
||||
(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Int))),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true) // TODO: no test coverage
|
||||
.allow_variants_without_examples(true)
|
||||
.required("string", SyntaxShape::String, "the string to find in the input")
|
||||
|
@ -29,7 +29,12 @@ impl Command for SubCommand {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("str length")
|
||||
.input_output_types(vec![(Type::String, Type::Int), (Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Int)))])
|
||||
.input_output_types(vec![
|
||||
(Type::String, Type::Int),
|
||||
(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Int))),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.switch(
|
||||
"grapheme-clusters",
|
||||
|
@ -22,7 +22,9 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::String)),
|
||||
Type::List(Box::new(Type::String)),
|
||||
),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -30,7 +30,11 @@ impl Command for SubCommand {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("str starts-with")
|
||||
.input_output_types(vec![(Type::String, Type::Bool),(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool)))])
|
||||
.input_output_types(vec![
|
||||
(Type::String, Type::Bool),
|
||||
(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool))),
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.required("string", SyntaxShape::String, "the string to match")
|
||||
|
Reference in New Issue
Block a user