mirror of
https://github.com/nushell/nushell.git
synced 2024-12-17 20:51:57 +01:00
filtering empty lines
This commit is contained in:
parent
04990eeba4
commit
cb9db792a6
@ -39,9 +39,13 @@ impl Command for Lines {
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
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))),
|
||||
|
Loading…
Reference in New Issue
Block a user