From 9c1a3aa244b98832e73e7da33f3d3b45faceab79 Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Fri, 16 Dec 2022 18:47:07 +0300 Subject: [PATCH] nu-explore/ A few things (#7339) ref #7332 Signed-off-by: Maxim Zhiburt Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com> --- Cargo.lock | 1 + crates/nu-color-config/src/nu_style.rs | 65 +- crates/nu-command/src/viewers/explore.rs | 335 ++++++-- crates/nu-explore/Cargo.toml | 1 + crates/nu-explore/src/command.rs | 252 ------ crates/nu-explore/src/commands/config.rs | 171 ++++ crates/nu-explore/src/commands/config_show.rs | 137 +++ crates/nu-explore/src/commands/expand.rs | 100 +++ crates/nu-explore/src/commands/help.rs | 279 +++++-- crates/nu-explore/src/commands/mod.rs | 118 ++- crates/nu-explore/src/commands/nu.rs | 84 +- crates/nu-explore/src/commands/preview.rs | 82 -- crates/nu-explore/src/commands/quit.rs | 2 + crates/nu-explore/src/commands/table.rs | 281 +++++++ crates/nu-explore/src/commands/try.rs | 52 +- crates/nu-explore/src/commands/tweak.rs | 96 +++ crates/nu-explore/src/lib.rs | 161 +++- crates/nu-explore/src/nu_common/command.rs | 35 +- crates/nu-explore/src/nu_common/mod.rs | 15 +- crates/nu-explore/src/nu_common/string.rs | 14 + crates/nu-explore/src/nu_common/value.rs | 50 +- crates/nu-explore/src/pager/command_bar.rs | 54 ++ crates/nu-explore/src/{ => pager}/events.rs | 0 .../nu-explore/src/{pager.rs => pager/mod.rs} | 782 ++++++++---------- crates/nu-explore/src/pager/report.rs | 44 + crates/nu-explore/src/pager/status_bar.rs | 80 ++ crates/nu-explore/src/registry/command.rs | 138 ++++ crates/nu-explore/src/registry/mod.rs | 87 ++ crates/nu-explore/src/views/configuration.rs | 430 ++++++++++ crates/nu-explore/src/views/cursor/mod.rs | 71 ++ .../src/views/cursor/windowcursor.rs | 106 +++ .../nu-explore/src/views/cursor/xycursor.rs | 143 ++++ crates/nu-explore/src/views/information.rs | 6 +- crates/nu-explore/src/views/interative.rs | 150 +++- crates/nu-explore/src/views/mod.rs | 45 +- crates/nu-explore/src/views/preview.rs | 130 ++- crates/nu-explore/src/views/record/mod.rs | 663 +++++++++------ crates/nu-explore/src/views/record/tablew.rs | 596 ++++++++----- crates/nu-explore/src/views/util.rs | 156 ++++ crates/nu-protocol/src/config.rs | 5 - .../src/sample_config/default_config.nu | 68 +- 41 files changed, 4498 insertions(+), 1587 deletions(-) delete mode 100644 crates/nu-explore/src/command.rs create mode 100644 crates/nu-explore/src/commands/config.rs create mode 100644 crates/nu-explore/src/commands/config_show.rs create mode 100644 crates/nu-explore/src/commands/expand.rs delete mode 100644 crates/nu-explore/src/commands/preview.rs create mode 100644 crates/nu-explore/src/commands/table.rs create mode 100644 crates/nu-explore/src/commands/tweak.rs create mode 100644 crates/nu-explore/src/nu_common/string.rs create mode 100644 crates/nu-explore/src/pager/command_bar.rs rename crates/nu-explore/src/{ => pager}/events.rs (100%) rename crates/nu-explore/src/{pager.rs => pager/mod.rs} (66%) create mode 100644 crates/nu-explore/src/pager/report.rs create mode 100644 crates/nu-explore/src/pager/status_bar.rs create mode 100644 crates/nu-explore/src/registry/command.rs create mode 100644 crates/nu-explore/src/registry/mod.rs create mode 100644 crates/nu-explore/src/views/configuration.rs create mode 100644 crates/nu-explore/src/views/cursor/mod.rs create mode 100644 crates/nu-explore/src/views/cursor/windowcursor.rs create mode 100644 crates/nu-explore/src/views/cursor/xycursor.rs create mode 100644 crates/nu-explore/src/views/util.rs diff --git a/Cargo.lock b/Cargo.lock index fbd131a3f..1d72ef8ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2691,6 +2691,7 @@ dependencies = [ "nu-ansi-term", "nu-color-config", "nu-engine", + "nu-json", "nu-parser", "nu-protocol", "nu-table", diff --git a/crates/nu-color-config/src/nu_style.rs b/crates/nu-color-config/src/nu_style.rs index b55ce9763..ef6626716 100644 --- a/crates/nu-color-config/src/nu_style.rs +++ b/crates/nu-color-config/src/nu_style.rs @@ -1,13 +1,74 @@ use nu_ansi_term::{Color, Style}; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; -#[derive(Deserialize, PartialEq, Eq, Debug)] +#[derive(Deserialize, Serialize, PartialEq, Eq, Debug)] pub struct NuStyle { pub fg: Option, pub bg: Option, pub attr: Option, } +impl From