mirror of
https://github.com/nushell/nushell.git
synced 2024-11-09 01:54:39 +01:00
Fix math min
/max
signatures (#9830)
# Description Under the hood those are just `Value::partial_cmp` and this is defined for all values and defines a partial order over `any` Should address part of https://github.com/nushell/nushell/issues/9813 # User-Facing Changes Reenable all behavior before `0.83` # Tests + Formatting Added an example to `math min` showing this cursedness
This commit is contained in:
parent
9448225690
commit
6a7a23e3fa
@ -15,7 +15,7 @@ impl Command for SubCommand {
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("math max")
|
||||
.input_output_types(vec![
|
||||
(Type::List(Box::new(Type::Number)), Type::Number),
|
||||
(Type::List(Box::new(Type::Any)), Type::Any),
|
||||
(Type::Table(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
@ -23,7 +23,7 @@ impl Command for SubCommand {
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Returns the maximum of a list of numbers, or of columns in a table."
|
||||
"Returns the maximum of a list of values, or of columns in a table."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
|
@ -15,7 +15,7 @@ impl Command for SubCommand {
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("math min")
|
||||
.input_output_types(vec![
|
||||
(Type::List(Box::new(Type::Number)), Type::Number),
|
||||
(Type::List(Box::new(Type::Any)), Type::Any),
|
||||
(Type::Table(vec![]), Type::Record(vec![])),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
@ -23,7 +23,7 @@ impl Command for SubCommand {
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Finds the minimum within a list of numbers or tables."
|
||||
"Finds the minimum within a list of values or tables."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
@ -56,6 +56,11 @@ impl Command for SubCommand {
|
||||
span: Span::test_data(),
|
||||
}),
|
||||
},
|
||||
Example {
|
||||
description: "Find the minimum of a list of arbitrary values (Warning: Weird)",
|
||||
example: "[-50 'hello' true] | math min",
|
||||
result: Some(Value::test_bool(true)),
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user