Edited help text and examples in explore for readability (#7324)

# Description

* Various help messages were edited for clarity/grammar/etc.
* Some examples were made more interesting or relevant

# User-Facing Changes

See above.

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
Leon
2022-12-03 00:01:02 +10:00
committed by GitHub
parent fcdc474731
commit 5762489070
9 changed files with 59 additions and 62 deletions

View File

@ -31,16 +31,20 @@ impl Command for Explore {
.named(
"head",
SyntaxShape::Boolean,
"Setting it to false makes it doesn't show column headers",
"Show or hide column headers (default true)",
None,
)
.switch("index", "A flag to show a index beside the rows", Some('i'))
.switch("index", "Show row indexes when viewing a list", Some('i'))
.switch(
"reverse",
"Makes it start from the end. (like `more`)",
"Start with the viewport scrolled to the bottom",
Some('r'),
)
.switch("peek", "Return a last seen cell content", Some('p'))
.switch(
"peek",
"When quitting, output the value of the cell the cursor was on",
Some('p'),
)
.category(Category::Viewers)
}
@ -90,23 +94,24 @@ impl Command for Explore {
fn examples(&self) -> Vec<Example> {
vec![
Example {
description: "List the files in current directory, an looking at them via explore.",
example: r#"ls | explore"#,
description: "Explore the system information record",
example: r#"sys | explore"#,
result: None,
},
Example {
description: "Inspect system information (explore with index).",
example: r#"sys | explore -i"#,
description: "Explore the output of `ls` without column names",
example: r#"ls | explore --head false"#,
result: None,
},
Example {
description: "Inspect $nu information (explore with no column names).",
example: r#"$nu | explore --head false"#,
description: "Explore a list of Markdown files' contents, with row indexes",
example: r#"glob *.md | each { open } | explore -i"#,
result: None,
},
Example {
description: "Inspect $nu information and return an entity where you've stopped.",
example: r#"$nu | explore --peek"#,
description:
"Explore a JSON file, then save the last visited sub-structure to a file",
example: r#"open file.json | explore -p | to json | save part.json"#,
result: None,
},
]