mirror of
https://github.com/nushell/nushell
synced 2024-12-28 05:53:09 +00:00
filtering empty lines
This commit is contained in:
parent
04990eeba4
commit
cb9db792a6
1 changed files with 7 additions and 3 deletions
|
@ -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 a new issue