forked from extern/nushell
Remove Signature.vectorizes_over_list
entirely (#9777)
# Description With the current typechecking logic this property has no effect. It was only used in the example testing, and provided some indication of this vectorizing property. With #9742 all commands that previously declared it have explicit list signatures. If we want to get it back in the future we can reconstruct it from the signature. Simplifies the example testing a bit. # User-Facing Changes Causes a breaking change for plugins that previously declared it. While this causes a compile fail, this was already broken by our more stringent type checking. This will be a good reminder for plugin authors to update their signature as well to reflect the more stringent type checking.
This commit is contained in:
parent
d9230a76f3
commit
b2e191f836
@ -43,7 +43,6 @@ mod test_examples {
|
||||
&mut make_engine_state(cmd.clone_box()),
|
||||
&signature.input_output_types,
|
||||
signature.operates_on_cell_paths(),
|
||||
signature.vectorizes_over_list,
|
||||
),
|
||||
);
|
||||
check_example_evaluates_to_expected_output(&example, cwd.as_path(), &mut engine_state);
|
||||
|
@ -22,7 +22,6 @@ impl Command for BitsAnd {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required(
|
||||
"target",
|
||||
SyntaxShape::Int,
|
||||
|
@ -23,7 +23,6 @@ impl Command for BitsNot {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.switch(
|
||||
"signed",
|
||||
|
@ -22,7 +22,6 @@ impl Command for BitsOr {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required(
|
||||
"target",
|
||||
SyntaxShape::Int,
|
||||
|
@ -25,7 +25,6 @@ impl Command for BitsRol {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("bits", SyntaxShape::Int, "number of bits to rotate left")
|
||||
.switch(
|
||||
"signed",
|
||||
|
@ -25,7 +25,6 @@ impl Command for BitsRor {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("bits", SyntaxShape::Int, "number of bits to rotate right")
|
||||
.switch(
|
||||
"signed",
|
||||
|
@ -25,7 +25,6 @@ impl Command for BitsShl {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("bits", SyntaxShape::Int, "number of bits to shift left")
|
||||
.switch(
|
||||
"signed",
|
||||
|
@ -25,7 +25,6 @@ impl Command for BitsShr {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("bits", SyntaxShape::Int, "number of bits to shift right")
|
||||
.switch(
|
||||
"signed",
|
||||
|
@ -22,7 +22,6 @@ impl Command for BitsXor {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required(
|
||||
"target",
|
||||
SyntaxShape::Int,
|
||||
|
@ -39,7 +39,6 @@ impl Command for BytesAdd {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.required("data", SyntaxShape::Binary, "the binary to add")
|
||||
.named(
|
||||
|
@ -46,7 +46,6 @@ impl Command for BytesAt {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("range", SyntaxShape::Range, "the range to get bytes")
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -26,7 +26,6 @@ impl Command for BytesLen {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.rest(
|
||||
"rest",
|
||||
SyntaxShape::CellPath,
|
||||
|
@ -21,7 +21,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Float)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Float)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Float)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Platform)
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ impl Command for SubCommand {
|
||||
SyntaxShape::CellPath,
|
||||
"for a data structure input, add links to all strings at the given cell paths",
|
||||
)
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Platform)
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ impl Command for DecodeHex {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.rest(
|
||||
"rest",
|
||||
SyntaxShape::CellPath,
|
||||
|
@ -25,7 +25,6 @@ impl Command for EncodeHex {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.rest(
|
||||
"rest",
|
||||
SyntaxShape::CellPath,
|
||||
|
@ -12,7 +12,6 @@ pub fn check_example_input_and_output_types_match_command_signature(
|
||||
engine_state: &mut Box<EngineState>,
|
||||
signature_input_output_types: &Vec<(Type, Type)>,
|
||||
signature_operates_on_cell_paths: bool,
|
||||
signature_vectorizes_over_list: bool,
|
||||
) -> HashSet<(Type, Type)> {
|
||||
let mut witnessed_type_transformations = HashSet::<(Type, Type)>::new();
|
||||
|
||||
@ -37,40 +36,6 @@ pub fn check_example_input_and_output_types_match_command_signature(
|
||||
}
|
||||
});
|
||||
|
||||
// The example type checks as vectorization over an input list if both:
|
||||
// 1. The command is declared to vectorize over list input.
|
||||
// 2. There exists an entry t -> u in the type map such that the
|
||||
// example_input_type is a subtype of list<t> and the
|
||||
// example_output_type is a subtype of list<u>.
|
||||
let example_matches_signature_via_vectorization_over_list =
|
||||
signature_vectorizes_over_list
|
||||
&& match &example_input_type {
|
||||
Type::List(ex_in_type) => {
|
||||
match signature_input_output_types.iter().find_map(
|
||||
|(sig_in_type, sig_out_type)| {
|
||||
if ex_in_type.is_subtype(sig_in_type) {
|
||||
Some((sig_in_type, sig_out_type))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
) {
|
||||
Some((sig_in_type, sig_out_type)) => match &example_output_type {
|
||||
Type::List(ex_out_type)
|
||||
if ex_out_type.is_subtype(sig_out_type) =>
|
||||
{
|
||||
witnessed_type_transformations
|
||||
.insert((sig_in_type.clone(), sig_out_type.clone()));
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
||||
// The example type checks as a cell path operation if both:
|
||||
// 1. The command is declared to operate on cell paths.
|
||||
// 2. The example_input_type is list or record or table, and the example
|
||||
@ -80,22 +45,22 @@ pub fn check_example_input_and_output_types_match_command_signature(
|
||||
// TODO: This is too permissive; it should make use of the signature.input_output_types at least.
|
||||
&& example_output_type.to_shape() == example_input_type.to_shape();
|
||||
|
||||
if !(example_matches_signature
|
||||
|| example_matches_signature_via_vectorization_over_list
|
||||
|| example_matches_signature_via_cell_path_operation)
|
||||
{
|
||||
if !(example_matches_signature || example_matches_signature_via_cell_path_operation) {
|
||||
panic!(
|
||||
"The example `{}` demonstrates a transformation of type {:?} -> {:?}. \
|
||||
"The example `{}` demonstrates a transformation of type {:?} -> {:?}. \
|
||||
However, this does not match the declared signature: {:?}.{} \
|
||||
For this command, `vectorizes_over_list` is {} and `operates_on_cell_paths()` is {}.",
|
||||
example.example,
|
||||
example_input_type,
|
||||
example_output_type,
|
||||
signature_input_output_types,
|
||||
if signature_input_output_types.is_empty() { " (Did you forget to declare the input and output types for the command?)" } else { "" },
|
||||
signature_vectorizes_over_list,
|
||||
signature_operates_on_cell_paths
|
||||
);
|
||||
For this command `operates_on_cell_paths()` is {}.",
|
||||
example.example,
|
||||
example_input_type,
|
||||
example_output_type,
|
||||
signature_input_output_types,
|
||||
if signature_input_output_types.is_empty() {
|
||||
" (Did you forget to declare the input and output types for the command?)"
|
||||
} else {
|
||||
""
|
||||
},
|
||||
signature_operates_on_cell_paths
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ mod test_examples {
|
||||
&mut make_engine_state(cmd.clone_box()),
|
||||
&signature.input_output_types,
|
||||
signature.operates_on_cell_paths(),
|
||||
signature.vectorizes_over_list,
|
||||
),
|
||||
);
|
||||
check_example_evaluates_to_expected_output(&example, cwd.as_path(), &mut engine_state);
|
||||
|
@ -54,7 +54,6 @@ impl Command for Fill {
|
||||
// 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",
|
||||
|
@ -46,7 +46,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.rest(
|
||||
"rest",
|
||||
SyntaxShape::CellPath,
|
||||
|
@ -70,7 +70,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Int)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.named("radix", SyntaxShape::Number, "radix of integer", Some('r'))
|
||||
.switch("little-endian", "use little-endian byte decoding", None)
|
||||
|
@ -46,7 +46,6 @@ mod test_examples {
|
||||
&mut make_engine_state(cmd.clone_box()),
|
||||
&signature.input_output_types,
|
||||
signature.operates_on_cell_paths(),
|
||||
signature.vectorizes_over_list,
|
||||
),
|
||||
);
|
||||
check_example_evaluates_to_expected_output(&example, cwd.as_path(), &mut engine_state);
|
||||
|
@ -19,7 +19,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Number)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Number)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Number)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ impl Command for SubCommand {
|
||||
),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Number)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.named(
|
||||
"precision",
|
||||
|
@ -19,7 +19,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::Number)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Math)
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ impl Command for SubCommand {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.switch(
|
||||
"all",
|
||||
"encode all non-alphanumeric chars including `/`, `.`, `:`",
|
||||
|
@ -29,7 +29,6 @@ impl Command for DecodeBase64 {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.named(
|
||||
"character-set",
|
||||
|
@ -35,7 +35,6 @@ impl Command for EncodeBase64 {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.named(
|
||||
"character-set",
|
||||
|
@ -20,7 +20,6 @@ impl Command for SubCommand {
|
||||
(Type::String, Type::List(Box::new(Type::String))),
|
||||
(Type::List(Box::new(Type::String)), Type::Table(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.required(
|
||||
"separator",
|
||||
|
@ -26,7 +26,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -24,7 +24,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -24,7 +24,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -26,7 +26,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::String)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -26,7 +26,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::String)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -25,7 +25,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -25,7 +25,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -26,7 +26,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -23,7 +23,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -36,7 +36,6 @@ impl Command for SubCommand {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool)))
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("string", SyntaxShape::String, "the substring to find")
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -35,7 +35,6 @@ impl Command for SubCommand {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.required("string", SyntaxShape::String, "the string to match")
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -29,7 +29,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::List(Box::new(Type::String)))),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Strings)
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(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")
|
||||
.switch(
|
||||
|
@ -36,7 +36,6 @@ impl Command for SubCommand {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.switch(
|
||||
"grapheme-clusters",
|
||||
"count length using grapheme clusters (all visible chars have length 1)",
|
||||
|
@ -44,7 +44,6 @@ impl Command for SubCommand {
|
||||
Type::List(Box::new(Type::String)),
|
||||
),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.required("find", SyntaxShape::String, "the pattern to find")
|
||||
.required("replace", SyntaxShape::String, "the replacement string")
|
||||
.rest(
|
||||
|
@ -26,7 +26,6 @@ impl Command for SubCommand {
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.vectorizes_over_list(true)
|
||||
.rest(
|
||||
"rest",
|
||||
SyntaxShape::CellPath,
|
||||
|
@ -36,7 +36,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.required("string", SyntaxShape::String, "the string to match")
|
||||
.rest(
|
||||
|
@ -48,7 +48,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.switch(
|
||||
"grapheme-clusters",
|
||||
|
@ -44,7 +44,6 @@ impl Command for SubCommand {
|
||||
(Type::Table(vec![]), Type::Table(vec![])),
|
||||
(Type::Record(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.vectorizes_over_list(true)
|
||||
.allow_variants_without_examples(true)
|
||||
.rest(
|
||||
"rest",
|
||||
|
@ -143,11 +143,6 @@ impl PluginSignature {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn vectorizes_over_list(mut self, vectorizes_over_list: bool) -> PluginSignature {
|
||||
self.sig = self.sig.vectorizes_over_list(vectorizes_over_list);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the input-output type signature variants of the command
|
||||
pub fn input_output_types(mut self, input_output_types: Vec<(Type, Type)>) -> PluginSignature {
|
||||
self.sig = self.sig.input_output_types(input_output_types);
|
||||
|
@ -112,7 +112,6 @@ pub struct Signature {
|
||||
pub required_positional: Vec<PositionalArg>,
|
||||
pub optional_positional: Vec<PositionalArg>,
|
||||
pub rest_positional: Option<PositionalArg>,
|
||||
pub vectorizes_over_list: bool,
|
||||
pub named: Vec<Flag>,
|
||||
pub input_output_types: Vec<(Type, Type)>,
|
||||
pub allow_variants_without_examples: bool,
|
||||
@ -212,7 +211,6 @@ impl Signature {
|
||||
required_positional: vec![],
|
||||
optional_positional: vec![],
|
||||
rest_positional: None,
|
||||
vectorizes_over_list: false,
|
||||
input_output_types: vec![],
|
||||
allow_variants_without_examples: false,
|
||||
named: vec![],
|
||||
@ -464,11 +462,6 @@ impl Signature {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn vectorizes_over_list(mut self, vectorizes_over_list: bool) -> Signature {
|
||||
self.vectorizes_over_list = vectorizes_over_list;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the input-output type signature variants of the command
|
||||
pub fn input_output_types(mut self, input_output_types: Vec<(Type, Type)>) -> Signature {
|
||||
self.input_output_types = input_output_types;
|
||||
|
Loading…
Reference in New Issue
Block a user