diff --git a/crates/nu-command/src/viewers/explore.rs b/crates/nu-command/src/viewers/explore.rs index c459bcb254..9698253709 100644 --- a/crates/nu-command/src/viewers/explore.rs +++ b/crates/nu-command/src/viewers/explore.rs @@ -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 { 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, }, ] diff --git a/crates/nu-explore/src/commands/help.rs b/crates/nu-explore/src/commands/help.rs index 02e1afdcd1..1ca6825c07 100644 --- a/crates/nu-explore/src/commands/help.rs +++ b/crates/nu-explore/src/commands/help.rs @@ -64,16 +64,16 @@ impl ViewCommand for HelpCmd { fn help(&self) -> Option { Some(HelpManual { name: "help", - description: "Looks up a help information about a command or a `explore`", + description: "Explore the help page for `explore`", arguments: vec![], examples: vec![ HelpExample { example: "help", - description: "Open a help information about the `explore`", + description: "Open the help page for all of `explore`", }, HelpExample { example: "help nu", - description: "Find a help list of `nu` command", + description: "Open the help page for the `nu` explore command", }, HelpExample { example: "help help", @@ -161,20 +161,20 @@ fn help_frame_data( #[rustfmt::skip] let shortcuts = [ - (":", "view", commands, "Run a command"), - ("/", "view", null!(), "Search via pattern"), - ("?", "view", null!(), "Search via pattern but results will be reversed when you press "), - ("n", "view", null!(), "Gets to the next found element in search"), - ("i", "view", null!(), "Turn on a cursor mode so you can inspect values"), - ("t", "view", null!(), "Transpose table, so columns became rows and vice versa"), - ("Up", "", null!(), "Moves to an element above"), - ("Down", "", null!(), "Moves to an element bellow"), - ("Left", "", null!(), "Moves to an element to the left"), - ("Right", "", null!(), "Moves to an element to the right"), - ("PgDown", "view", null!(), "Moves to an a bunch of elements bellow"), - ("PgUp", "view", null!(), "Moves to an a bunch of elements above"), - ("Esc", "", null!(), "Exits a cursor mode. Exists an expected element."), - ("Enter", "cursor", null!(), "Inspect a chosen element"), + (":", "view", commands, "Run an explore command (explore the 'information' cell of this row to list commands)"), + ("/", "view", null!(), "Search for a pattern"), + ("?", "view", null!(), "Search for a pattern, but the key now scrolls to the previous result"), + ("n", "view", null!(), "When searching, scroll to the next search result"), + ("i", "view", null!(), "Enters cursor mode to inspect individual cells"), + ("t", "view", null!(), "Transpose table, so that columns become rows and vice versa"), + ("Up", "", null!(), "Moves the cursor or viewport one row up"), + ("Down", "", null!(), "Moves the cursor or viewport one row down"), + ("Left", "", null!(), "Moves the cursor or viewport one column left"), + ("Right", "", null!(), "Moves the cursor or viewport one column right"), + ("PgDown", "view", null!(), "Moves the cursor or viewport one page of rows down"), + ("PgUp", "view", null!(), "Moves the cursor or viewport one page of rows up"), + ("Esc", "", null!(), "Exits cursor mode. Exits the currently explored data."), + ("Enter", "cursor", null!(), "In cursor mode, explore the data of the selected cell"), ]; let headers = headers.iter().map(|s| s.to_string()).collect(); diff --git a/crates/nu-explore/src/commands/nu.rs b/crates/nu-explore/src/commands/nu.rs index f33c1977b8..9c6dd6aec8 100644 --- a/crates/nu-explore/src/commands/nu.rs +++ b/crates/nu-explore/src/commands/nu.rs @@ -44,16 +44,17 @@ impl ViewCommand for NuCmd { fn help(&self) -> Option { Some(HelpManual { name: "nu", - description: "Run a nu command. You can use a presented table as an input", + description: + "Run a Nushell command. The data currently being explored is piped into it.", arguments: vec![], examples: vec![ HelpExample { example: "where type == 'file'", - description: "Filter data to get only entries with a type being a 'file'", + description: "Filter data to show only rows whose type is 'file'", }, HelpExample { - example: "get scope | get examples", - description: "Get a inner values", + example: "get scope.examples", + description: "Navigate to a deeper value inside the data", }, HelpExample { example: "open Cargo.toml", diff --git a/crates/nu-explore/src/commands/preview.rs b/crates/nu-explore/src/commands/preview.rs index 4eba5b47b4..659c9457e1 100644 --- a/crates/nu-explore/src/commands/preview.rs +++ b/crates/nu-explore/src/commands/preview.rs @@ -40,7 +40,8 @@ impl ViewCommand for PreviewCmd { fn help(&self) -> Option { Some(HelpManual { name: "preview", - description: "Preview current value/table if any is currently in use", + description: + "View the currently selected cell's data using the `table` Nushell command", arguments: vec![], examples: vec![], }) diff --git a/crates/nu-explore/src/commands/quit.rs b/crates/nu-explore/src/commands/quit.rs index f3b03f1403..e8e6c365e8 100644 --- a/crates/nu-explore/src/commands/quit.rs +++ b/crates/nu-explore/src/commands/quit.rs @@ -28,7 +28,7 @@ impl SimpleCommand for QuitCmd { fn help(&self) -> Option { Some(HelpManual { name: "quit", - description: "Quit", + description: "Quit and return to Nushell", arguments: vec![], examples: vec![], }) diff --git a/crates/nu-explore/src/commands/try.rs b/crates/nu-explore/src/commands/try.rs index 2dd56c29be..d4edb876d9 100644 --- a/crates/nu-explore/src/commands/try.rs +++ b/crates/nu-explore/src/commands/try.rs @@ -40,11 +40,11 @@ impl ViewCommand for TryCmd { fn help(&self) -> Option { Some(HelpManual { name: "try", - description: "Opens a dynamic REPL to run nu commands", + description: "Opens a panel in which to run Nushell commands and explore their output", arguments: vec![], examples: vec![HelpExample { example: "try open Cargo.toml", - description: "Optionally you can provide a command which will be run right away", + description: "Optionally, you can provide a command which will be run immediately", }], }) } diff --git a/crates/nu-explore/src/pager.rs b/crates/nu-explore/src/pager.rs index a15e45386b..92b7224c53 100644 --- a/crates/nu-explore/src/pager.rs +++ b/crates/nu-explore/src/pager.rs @@ -329,7 +329,7 @@ fn render_status_bar(f: &mut Frame, area: Rect, report: Report, theme: &StyleCon } fn report_msg_style(report: &Report, theme: &StyleConfig, style: NuStyle) -> NuStyle { - if matches!(report.level, Severentity::Info) { + if matches!(report.level, Severity::Info) { style } else { report_level_style(report.level, theme) @@ -834,11 +834,11 @@ impl Widget for StatusBar { } } -fn report_level_style(level: Severentity, theme: &StyleConfig) -> NuStyle { +fn report_level_style(level: Severity, theme: &StyleConfig) -> NuStyle { match level { - Severentity::Info => theme.status_info, - Severentity::Warn => theme.status_warn, - Severentity::Err => theme.status_error, + Severity::Info => theme.status_info, + Severity::Warn => theme.status_warn, + Severity::Err => theme.status_error, } } @@ -935,13 +935,13 @@ pub struct ViewInfo { #[derive(Debug, Clone)] pub struct Report { pub message: String, - pub level: Severentity, + pub level: Severity, pub context: String, pub context2: String, } impl Report { - pub fn new(message: String, level: Severentity, context: String, context2: String) -> Self { + pub fn new(message: String, level: Severity, context: String, context2: String) -> Self { Self { message, level, @@ -951,28 +951,18 @@ impl Report { } pub fn error(message: impl Into) -> Self { - Self::new( - message.into(), - Severentity::Err, - String::new(), - String::new(), - ) + Self::new(message.into(), Severity::Err, String::new(), String::new()) } } impl Default for Report { fn default() -> Self { - Self::new( - String::new(), - Severentity::Info, - String::new(), - String::new(), - ) + Self::new(String::new(), Severity::Info, String::new(), String::new()) } } #[derive(Debug, Clone, Copy)] -pub enum Severentity { +pub enum Severity { Info, #[allow(dead_code)] Warn, diff --git a/crates/nu-explore/src/views/preview.rs b/crates/nu-explore/src/views/preview.rs index d7c958e782..960fd1971a 100644 --- a/crates/nu-explore/src/views/preview.rs +++ b/crates/nu-explore/src/views/preview.rs @@ -10,7 +10,7 @@ use tui::layout::Rect; use crate::{ nu_common::{NuSpan, NuText}, - pager::{Frame, Report, Severentity, Transition, ViewConfig, ViewInfo}, + pager::{Frame, Report, Severity, Transition, ViewConfig, ViewInfo}, }; use super::{coloredtextw::ColoredTextW, Layout, View}; @@ -105,7 +105,7 @@ impl View for Preview { if is_end { let report = Report::new( String::from("END"), - Severentity::Info, + Severity::Info, String::new(), String::new(), ); @@ -137,7 +137,7 @@ impl View for Preview { if is_end { let report = Report::new( String::from("END"), - Severentity::Info, + Severity::Info, String::new(), String::new(), ); diff --git a/crates/nu-explore/src/views/record/mod.rs b/crates/nu-explore/src/views/record/mod.rs index 5f32968c5e..b6b5ab1722 100644 --- a/crates/nu-explore/src/views/record/mod.rs +++ b/crates/nu-explore/src/views/record/mod.rs @@ -12,7 +12,7 @@ use tui::{layout::Rect, widgets::Block}; use crate::{ nu_common::{collect_input, NuConfig, NuSpan, NuStyleTable, NuText}, pager::{ - make_styled_string, nu_style_to_tui, Frame, Position, Report, Severentity, StyleConfig, + make_styled_string, nu_style_to_tui, Frame, Position, Report, Severity, StyleConfig, TableConfig, Transition, ViewConfig, ViewInfo, }, views::ElementInfo, @@ -584,7 +584,7 @@ fn create_records_report( message: title, context: covered_percent, context2: cursor, - level: Severentity::Info, + level: Severity::Info, } }