nushell/src/commands/to_array.rs

12 lines
290 B
Rust
Raw Normal View History

2019-05-16 00:58:44 +02:00
use crate::object::Value;
2019-05-13 23:00:25 +02:00
use crate::prelude::*;
pub fn to_array(args: CommandArgs) -> Result<OutputStream, ShellError> {
let out = args.input.values.collect();
Ok(out
.map(|vec: Vec<_>| stream![Value::List(vec)])
.flatten_stream()
.from_input_stream())
2019-05-13 23:00:25 +02:00
}