2019-06-01 03:43:59 +00:00
|
|
|
use crate::errors::ShellError;
|
2019-07-12 19:22:08 +00:00
|
|
|
use crate::object::Value;
|
2019-06-01 03:43:59 +00:00
|
|
|
use crate::prelude::*;
|
|
|
|
|
|
|
|
// TODO: "Amount remaining" wrapper
|
|
|
|
|
|
|
|
pub fn trim(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|
|
|
let input = args.input;
|
|
|
|
|
|
|
|
Ok(input
|
2019-07-03 20:31:15 +00:00
|
|
|
.values
|
2019-07-09 04:31:26 +00:00
|
|
|
.map(move |v| {
|
|
|
|
let string = String::extract(&v)?;
|
|
|
|
ReturnSuccess::value(Value::string(string.trim()).spanned(v.span))
|
|
|
|
})
|
2019-07-03 20:31:15 +00:00
|
|
|
.to_output_stream())
|
2019-06-01 03:43:59 +00:00
|
|
|
}
|