add a draft body to run as in to json

Real computations are missing and will be added later.
This commit is contained in:
amtoine 2023-03-08 19:59:30 +01:00
parent f5d1eddc8a
commit ac2f6b79e6
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -47,11 +47,30 @@ impl Command for ToNuon {
call: &Call, call: &Call,
input: PipelineData, input: PipelineData,
) -> Result<PipelineData, ShellError> { ) -> Result<PipelineData, ShellError> {
Ok(Value::String { let raw = call.has_flag("raw");
val: to_nuon(call, input)?, let use_tabs = call.has_flag("tabs");
span: call.head,
let span = call.head;
let nuon_value = to_nuon(call, input)?;
let nuon_result: Result<String, ()> = Ok(nuon_value);
match nuon_result {
Ok(serde_nuon_string) => Ok(Value::String {
val: serde_nuon_string,
span,
}
.into_pipeline_data()),
_ => Ok(Value::Error {
error: ShellError::CantConvert {
to_type: "NUON".into(),
from_type: "TYPE".to_string(),
span,
help: None,
},
}
.into_pipeline_data()),
} }
.into_pipeline_data())
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {