package tbls

  1. Overview
  2. Docs
Pure OCaml library for rendering tabular data

Install

dune-project
 Dependency

Authors

Maintainers

Sources

tbls-0.4.0.tbz
sha256=27152327074676748020d11ce3cc91cc8c37cd343db64591b1f7af0ff5b62c1d
sha512=f440832e1716c9faf5893f24ce54501fbe373d92889b8612e0661d279c1b92ed2f040ea8f14c031bb00bd7b381950ab23a027cac530eb53834ef3d4c730c6c11

doc/README.html

tbls

License

Pure OCaml library for rendering tabular data to plain text, Markdown, or HTML.

Accepts typed column descriptors or raw string rows, infers integer and float columns, right-aligns numeric values, and returns a string.

No runtime dependencies.

Installation

opam install tbls

Add to your dune file:

(libraries tbls)

Quick start

open Tbls

let () =
  table_of_rows ~header:["Name"; "Score"]
    [[Some "John"; Some "99"]; [Some "Paul"; Some "68"]]
    (Text Border.Unicode)
  |> Result.get_ok
  |> print_endline
┌───────┬───────┐
│ Name  │ Score │
├───────┼───────┤
│ John  │    99 │
│ Paul  │    68 │
└───────┴───────┘

The CLI reads CSV from stdin or files:

printf 'Name,Score\nJohn,99\nPaul,68\n' | tbls --border unicode

See man tbls for all options and exit codes.

License

ISC. See LICENSE.