feat(table): add 'double' table mode (#16013)

# Description

Add 'double' table mode, that is similar to `compact_double` but with
left and right border lines. This is similar to how there exist both
`single` and `compact`, but there is no `double` to compliment
`compact_double`. Printing `[ { a: 1, b: 11 }, { a: 2, b:12 } ]` looks
like this:

```
╔═══╦═══╦════╗
║ # ║ a ║ b  ║
╠═══╬═══╬════╣
║ 0 ║ 1 ║ 11 ║
║ 1 ║ 2 ║ 12 ║
╚═══╩═══╩════╝
```

The implementation is mostly a one-to-one of #15672 and #15681.

# User-Facing Changes

New value `double` to set as `$env.config.table.mode`.

# Tests + Formatting

Tests are added following the example of adding 'single' mode.

# After Submitting
This commit is contained in:
Evgeni Chasnovski
2025-06-20 22:09:55 +03:00
committed by GitHub
parent 4f7e9aac62
commit c3079a14d9
7 changed files with 64 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ pub enum TableMode {
AsciiRounded,
BasicCompact,
Single,
Double,
}
impl FromStr for TableMode {
@@ -46,8 +47,9 @@ impl FromStr for TableMode {
"ascii_rounded" => Ok(Self::AsciiRounded),
"basic_compact" => Ok(Self::BasicCompact),
"single" => Ok(Self::Single),
"double" => Ok(Self::Double),
_ => Err(
"'basic', 'thin', 'light', 'compact', 'with_love', 'compact_double', 'rounded', 'reinforced', 'heavy', 'none', 'psql', 'markdown', 'dots', 'restructured', 'ascii_rounded', 'basic_compact' or 'single'",
"'basic', 'thin', 'light', 'compact', 'with_love', 'compact_double', 'rounded', 'reinforced', 'heavy', 'none', 'psql', 'markdown', 'dots', 'restructured', 'ascii_rounded', 'basic_compact', 'single', or 'double'",
),
}
}