From 1eb28c6cb65a9593992a4990cfb2c7699827582f Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Wed, 21 Oct 2020 08:53:08 -0500 Subject: [PATCH] add heavy & none table border options (#2686) --- crates/nu-cli/src/commands/table/options.rs | 2 + crates/nu-table/src/table.rs | 60 +++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/crates/nu-cli/src/commands/table/options.rs b/crates/nu-cli/src/commands/table/options.rs index fef8a9cb1a..476fbdbd85 100644 --- a/crates/nu-cli/src/commands/table/options.rs +++ b/crates/nu-cli/src/commands/table/options.rs @@ -59,6 +59,8 @@ pub fn table_mode(config: &NuConfig) -> nu_table::Theme { Ok(m) if m == "compact_double" => nu_table::Theme::compact_double(), Ok(m) if m == "rounded" => nu_table::Theme::rounded(), Ok(m) if m == "reinforced" => nu_table::Theme::reinforced(), + Ok(m) if m == "heavy" => nu_table::Theme::heavy(), + Ok(m) if m == "none" => nu_table::Theme::none(), _ => nu_table::Theme::compact(), }) } diff --git a/crates/nu-table/src/table.rs b/crates/nu-table/src/table.rs index 1206a7310a..1e39ad02b3 100644 --- a/crates/nu-table/src/table.rs +++ b/crates/nu-table/src/table.rs @@ -536,6 +536,66 @@ impl Theme { print_bottom_border: true, } } + + #[allow(unused)] + pub fn heavy() -> Theme { + Theme { + top_left: '┏', + middle_left: '┣', + bottom_left: '┗', + top_center: '┳', + center: '╋', + bottom_center: '┻', + top_right: '┓', + middle_right: '┫', + bottom_right: '┛', + top_horizontal: '━', + middle_horizontal: '━', + bottom_horizontal: '━', + + left_vertical: '┃', + center_vertical: '┃', + right_vertical: '┃', + + separate_header: true, + separate_rows: false, + + print_left_border: true, + print_right_border: true, + print_top_border: true, + print_bottom_border: true, + } + } + #[allow(unused)] + pub fn none() -> Theme { + Theme { + top_left: ' ', + middle_left: ' ', + bottom_left: ' ', + top_center: ' ', + center: ' ', + bottom_center: ' ', + top_right: ' ', + middle_right: ' ', + bottom_right: ' ', + + top_horizontal: ' ', + middle_horizontal: ' ', + bottom_horizontal: ' ', + + left_vertical: ' ', + center_vertical: ' ', + right_vertical: ' ', + + separate_header: false, + separate_rows: false, + + print_left_border: false, + print_right_border: false, + print_top_border: false, + print_bottom_border: false, + } + } } impl Table {