mirror of
https://github.com/nushell/nushell
synced 2024-12-28 14:03:09 +00:00
add example to parse command, with row output (#2256)
This commit is contained in:
parent
e4b42b54ad
commit
e66a8258ec
1 changed files with 11 additions and 0 deletions
|
@ -41,6 +41,17 @@ impl WholeStreamCommand for Command {
|
|||
) -> Result<OutputStream, ShellError> {
|
||||
operate(args, registry).await
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
let mut row = IndexMap::new();
|
||||
row.insert("foo".to_string(), Value::from("hi"));
|
||||
row.insert("bar".to_string(), Value::from("there"));
|
||||
vec![Example {
|
||||
description: "Parse a string into two named columns",
|
||||
example: "echo \"hi there\" | parse \"{foo} {bar}\"",
|
||||
result: Some(vec![UntaggedValue::row(row).into()]),
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn operate(
|
||||
|
|
Loading…
Reference in a new issue