mirror of
https://github.com/nushell/nushell.git
synced 2024-12-13 18:52:01 +01:00
16 lines
409 B
Rust
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())
|
|
}
|