add --raw, --indent and --tabs as in to json

This commit is contained in:
amtoine 2023-03-08 19:58:12 +01:00
parent 0df847da15
commit f5d1eddc8a
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -5,7 +5,7 @@ use nu_parser::escape_quote_string;
use nu_protocol::ast::{Call, RangeInclusion};
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type, Value,
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Span, Type, Value,
};
use once_cell::sync::Lazy;
@ -20,6 +20,19 @@ impl Command for ToNuon {
fn signature(&self) -> Signature {
Signature::build("to nuon")
.input_output_types(vec![(Type::Any, Type::String)])
.switch("raw", "remove all of the whitespace", Some('r'))
.named(
"indent",
SyntaxShape::Number,
"specify indentation width",
Some('i'),
)
.named(
"tabs",
SyntaxShape::Number,
"specify indentation tab quantity",
Some('t'),
)
.category(Category::Experimental)
}