Fix newly added examples. (#1830)

This commit is contained in:
Jason Gedge 2020-05-18 11:40:44 -04:00 committed by GitHub
parent acf13a6fcf
commit 5f1136dcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 12 deletions

View File

@ -44,10 +44,11 @@ impl WholeStreamCommand for Open {
open(args, registry)
}
fn examples(&self) -> &[Example] {
&[Example {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Opens \"users.csv\" and creates a table from the data",
example: "open users.csv",
result: None,
}]
}
}

View File

@ -33,10 +33,11 @@ impl WholeStreamCommand for Reject {
reject(args, registry)
}
fn examples(&self) -> &[Example] {
&[Example {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Lists the files in a directory without showing the modified column",
example: "ls | reject modified",
result: None,
}]
}
}

View File

@ -35,10 +35,11 @@ impl WholeStreamCommand for Touch {
touch(args, registry)
}
fn examples(&self) -> &[Example] {
&[Example {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Creates \"fixture.json\"",
example: "touch fixture.json",
result: None,
}]
}
}

View File

@ -27,10 +27,11 @@ impl WholeStreamCommand for Trim {
trim(args, registry)
}
fn examples(&self) -> &[Example] {
&[Example {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Trims surrounding whitespace and outputs \"Hello world\"",
example: "echo \" Hello world\" | trim",
result: Some(vec![Value::from("Hello world")]),
}]
}
}

View File

@ -27,10 +27,11 @@ impl WholeStreamCommand for Version {
version(args, registry)
}
fn examples(&self) -> &[Example] {
&[Example {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Display Nu version",
example: "version",
result: None,
}]
}
}

View File

@ -37,23 +37,27 @@ impl WholeStreamCommand for Where {
where_command(args, registry)
}
fn examples(&self) -> &[Example] {
&[
fn examples(&self) -> Vec<Example> {
vec![
Example {
description: "List all files in the current directory with sizes greater than 2kb",
example: "ls | where size > 2kb",
result: None,
},
Example {
description: "List only the files in the current directory",
example: "ls | where type == File",
result: None,
},
Example {
description: "List all files with names that contain \"Car\"",
example: "ls | where name =~ \"Car\"",
result: None,
},
Example {
description: "List all files that were modified in the last two months",
example: "ls | where modified <= 2M",
result: None,
},
]
}