mirror of
https://github.com/nushell/nushell.git
synced 2025-06-18 16:07:02 +02:00
add a draft body to run
as in to json
Real computations are missing and will be added later.
This commit is contained in:
parent
f5d1eddc8a
commit
ac2f6b79e6
@ -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> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user