From e66a8258ecfd744d6d70ebc3da037bf96f88e41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Sat, 25 Jul 2020 20:14:29 +0200 Subject: [PATCH] add example to parse command, with row output (#2256) --- crates/nu-cli/src/commands/parse/command.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/nu-cli/src/commands/parse/command.rs b/crates/nu-cli/src/commands/parse/command.rs index 80d55bfaaf..75364f2c9b 100644 --- a/crates/nu-cli/src/commands/parse/command.rs +++ b/crates/nu-cli/src/commands/parse/command.rs @@ -41,6 +41,17 @@ impl WholeStreamCommand for Command { ) -> Result { operate(args, registry).await } + + fn examples(&self) -> Vec { + 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(