mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 08:31:29 +02:00
Use explicit in/out list types for vectorized commands (#9742)
# Description All commands that declared `.vectorizes_over_list(true)` now also explicitly declare the list form of their scalar types. - Explicit in/out list signatures for nu-command - Explicit in/out list signatures for nu-cmd-extra - Add comments about cellpath behavior that is still unresolved # User-Facing Changes Our type signatures will now be more explicit about which commands support vectorization over lists. On the downside this is a bit more verbose and less systematic.
This commit is contained in:
committed by
GitHub
parent
4dbdb1fe54
commit
17f8ad7210
@@ -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",
|
||||
|
Reference in New Issue
Block a user