mirror of
https://github.com/nushell/nushell
synced 2025-01-07 10:49:03 +00:00
17 lines
437 B
Rust
17 lines
437 B
Rust
use crate::errors::ShellError;
|
|
use crate::object::Value;
|
|
use crate::prelude::*;
|
|
|
|
// TODO: "Amount remaining" wrapper
|
|
|
|
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()).spanned(v.span))
|
|
})
|
|
.to_output_stream())
|
|
}
|