From 2b13ac385622cbe8a70c5a3b54c4fd235fa98f12 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sat, 19 Sep 2020 12:10:34 -0500 Subject: [PATCH] more table themes rounded and reinforced (#2579) --- 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 5aa1c27dc..fef8a9cb1 100644 --- a/crates/nu-cli/src/commands/table/options.rs +++ b/crates/nu-cli/src/commands/table/options.rs @@ -57,6 +57,8 @@ pub fn table_mode(config: &NuConfig) -> nu_table::Theme { Ok(m) if m == "thin" => nu_table::Theme::thin(), Ok(m) if m == "with_love" => nu_table::Theme::with_love(), 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(), _ => nu_table::Theme::compact(), }) } diff --git a/crates/nu-table/src/table.rs b/crates/nu-table/src/table.rs index 78fdd5211..1206a7310 100644 --- a/crates/nu-table/src/table.rs +++ b/crates/nu-table/src/table.rs @@ -476,6 +476,66 @@ impl Theme { print_bottom_border: true, } } + + #[allow(unused)] + pub fn rounded() -> 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 reinforced() -> 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, + } + } } impl Table {