Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 3.4.1 -- UNRELEASED

- Removed some reflection warnings
- Changed the default style for tables to use thinner lines

## 3.4.0 -- 16 Jun 2025

- `clj-commons.ansi`:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Pretty can output pretty tabular data:
{:method :get
:path "/status"
:route-name :status}])
┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┓
Method Path Name
┣━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━━━━┫
:get / :root-page
:post /reset :reset
:get /status :status
┗━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━━━━┛
┌────────┬─────────┬────────────┐
Method Path │ Name
├────────┼─────────┼────────────┤
:get / :root-page
:post /reset :reset
:get /status :status
└────────┴─────────┴────────────┘
=> nil
```

Expand Down
32 changes: 15 additions & 17 deletions src/clj_commons/format/table.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,29 @@
width' (if width
(max width title-width)
(->> data
(map key)
(map str)
(map #(-> % key str .length))
(reduce max title-width)))]
(assoc column :width width')))

(def default-style
"Default style, with thick borders (using character graphics) and a header and footer."
"Default style, with thin borders (using character graphics) and a header and footer."
{:header-font :bold
:hbar ""
:hbar ""
:header? true
:header-left "┏━"
:header-sep "━┳━"
:header-right "━┓"
:header-left "┌─"
:header-sep "─┬─"
:header-right "─┐"
:divider? true
:divider-left "┣━"
:divider-sep "━╋━"
:divider-right "━┫"
:row-left " "
:row-sep " "
:row-right " "
:divider-left "├─"
:divider-sep "─┼─"
:divider-right "─┤"
:row-left " "
:row-sep " "
:row-right " "
:footer? true
:footer-left "┗━"
:footer-sep "━┻━"
:footer-right "━┛"})
:footer-left "└─"
:footer-sep "─┴─"
:footer-right "─┘"})

(def skinny-style
"Removes most of the borders and uses simple characters for column separators."
Expand All @@ -97,7 +95,7 @@
(def ^{:added "3.4.0"}
minimal-style
"A minimal style that uses only white-space as a column separator."
{:header-font :double-underlined
{:header-font :bold.double-underlined
:hbar " "
:header? false
:divider? false
Expand Down