nushell/src/commands/trim.rs
2019-08-05 20:54:29 +12:00

16 lines
409 B
Rust

use crate::errors::ShellError;
use crate::object::Value;
use crate::prelude::*;
pub fn trim(args: CommandArgs) -> Result<OutputStream, ShellError> {
let input = args.input;
Ok(input
.values
.map(move |v| {
let string = String::extract(&v)?;
ReturnSuccess::value(Value::string(string.trim()).simple_spanned(v.span()))
})
.to_output_stream())
}