From 2b955f82b74f3d281773be68e20242fdae1f8aa9 Mon Sep 17 00:00:00 2001 From: Yura Shatunov <46374280+volucris1@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:53:46 +0700 Subject: [PATCH] Fix #6330 (#6332) --- crates/nu-command/src/filters/first.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/nu-command/src/filters/first.rs b/crates/nu-command/src/filters/first.rs index e3f9f97eb..340bf3a11 100644 --- a/crates/nu-command/src/filters/first.rs +++ b/crates/nu-command/src/filters/first.rs @@ -53,6 +53,14 @@ impl Command for First { span: Span::test_data(), }), }, + Example { + description: "Return the first 2 items of a bytes", + example: "0x[01 23 45] | first 2", + result: Some(Value::Binary { + val: vec![0x01, 0x23], + span: Span::test_data(), + }), + }, ] } } @@ -153,10 +161,7 @@ fn first_helper( } } } else { - Err(ShellError::UnsupportedInput( - String::from("Cannot perform into string on empty input"), - head, - )) + Ok(PipelineData::new(head).set_metadata(metadata)) } } #[cfg(test)]