diff --git a/crates/nu-command/src/filters/first.rs b/crates/nu-command/src/filters/first.rs index 80c64ba996a87..405887be1a82b 100644 --- a/crates/nu-command/src/filters/first.rs +++ b/crates/nu-command/src/filters/first.rs @@ -69,6 +69,11 @@ impl Command for First { example: "0x[01 23 45] | first 2", result: Some(Value::binary(vec![0x01, 0x23], Span::test_data())), }, + Example { + description: "Return the first item of a range", + example: "1..3 | first", + result: Some(Value::test_int(1)), + }, ] } } diff --git a/crates/nu-command/src/filters/last.rs b/crates/nu-command/src/filters/last.rs index febd26597de00..b76ef482151bb 100644 --- a/crates/nu-command/src/filters/last.rs +++ b/crates/nu-command/src/filters/last.rs @@ -27,6 +27,7 @@ impl Command for Last { Type::Any, ), (Type::Binary, Type::Binary), + (Type::Range, Type::Any), ]) .optional( "rows", @@ -60,6 +61,11 @@ impl Command for Last { description: "Return the last 2 bytes of a binary value", result: Some(Value::binary(vec![0x23, 0x45], Span::test_data())), }, + Example { + example: "1..3 | last", + description: "Return the last item of a range", + result: Some(Value::test_int(3)), + }, ] }