From cb9db792a6f3327685c8998a723e83687bbc5c75 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 23 Sep 2021 20:44:50 +0100 Subject: [PATCH] filtering empty lines --- crates/nu-command/src/lines.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/lines.rs b/crates/nu-command/src/lines.rs index 09d5757465..3694f26e20 100644 --- a/crates/nu-command/src/lines.rs +++ b/crates/nu-command/src/lines.rs @@ -39,9 +39,13 @@ impl Command for Lines { .map(|s| s.to_string()) .collect::>(); - let iter = lines - .into_iter() - .map(move |s| Value::String { val: s, span }); + let iter = lines.into_iter().filter_map(move |s| { + if !s.is_empty() { + Some(Value::String { val: s, span }) + } else { + None + } + }); Value::Stream { stream: ValueStream(Rc::new(RefCell::new(iter))),