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) open(args, registry)
} }
fn examples(&self) -> &[Example] { fn examples(&self) -> Vec<Example> {
&[Example { vec![Example {
description: "Opens \"users.csv\" and creates a table from the data", description: "Opens \"users.csv\" and creates a table from the data",
example: "open users.csv", example: "open users.csv",
result: None,
}] }]
} }
} }

View File

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

View File

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

View File

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

View File

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