Print viewer table formatting.
Provides generic table printing with box-drawing separators.
Print viewer table formatting. Provides generic table printing with box-drawing separators.
(print-table {:keys [heading indent row-key-col columns rows] :or {indent 2}})Print a formatted table with box-drawing separators.
Takes a table specification map with: :heading - optional heading string printed before the table :indent - number of spaces to indent (default 2) :row-key-col - optional {:header "" :width N} for leftmost row-key column :columns - vector of {:header "Header" :width N :align :right|:left} :rows - vector of row data, each row is a vector of cell strings If :row-key-col specified, first element is the row key
Cell alignment defaults to :right. Column widths are auto-calculated from headers and data if not specified.
Example: (print-table {:heading "My Table" :row-key-col {:header "" :width 8} :columns [{:header "A"} {:header "B"}] :rows [["key1" "val1" "val2"] ["key2" "val3" "val4"]]})
Print a formatted table with box-drawing separators.
Takes a table specification map with:
:heading - optional heading string printed before the table
:indent - number of spaces to indent (default 2)
:row-key-col - optional {:header "" :width N} for leftmost row-key column
:columns - vector of {:header "Header" :width N :align :right|:left}
:rows - vector of row data, each row is a vector of cell strings
If :row-key-col specified, first element is the row key
Cell alignment defaults to :right. Column widths are auto-calculated from
headers and data if not specified.
Example:
(print-table
{:heading "My Table"
:row-key-col {:header "" :width 8}
:columns [{:header "A"} {:header "B"}]
:rows [["key1" "val1" "val2"]
["key2" "val3" "val4"]]})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |