nu 0.1.2

A shell for the GitHub era
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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())
}