mirror of
https://github.com/nushell/nushell.git
synced 2025-06-05 17:46:44 +02:00
add a few examples
This commit is contained in:
parent
c5fc7cd585
commit
8465c743dc
@ -86,11 +86,23 @@ impl Command for ToNuon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![
|
||||||
description: "Outputs a nuon string representing the contents of this list",
|
Example {
|
||||||
example: "[1 2 3] | to nuon",
|
description: "Outputs a NUON string representing the contents of this list, with default indentation (same as `to nuon --indent 2`)",
|
||||||
result: Some(Value::test_string("[1, 2, 3]")),
|
example: "[1 2 3] | to nuon",
|
||||||
}]
|
result: Some(Value::test_string("[\n 1,\n 2,\n 3\n]")),
|
||||||
|
},
|
||||||
|
Example {
|
||||||
|
description: "Outputs a NUON array of integers, as a raw unformatted NUON string",
|
||||||
|
example: "[1 2 3] | to nuon --raw",
|
||||||
|
result: Some(Value::test_string("[1, 2, 3]"))
|
||||||
|
},
|
||||||
|
Example {
|
||||||
|
description: "A more complex record with multiple data types",
|
||||||
|
example: "{date: 2000-01-01, data: [1 [2 3] 4.56]} | to nuon",
|
||||||
|
result: Some(Value::test_string("{\n date: 2000-01-01T00:00:00+00:00,\n data: [\n 1,\n [\n 2,\n 3\n ],\n 4.56\n ]\n}"))
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user