Pure OCaml library for rendering tabular data
https://ocaml.org/p/tbls/latest
- OCaml 99.2%
- Dune 0.8%
| bin | v0.4.0 | |
| demo | v0.4.0 | |
| lib | v0.4.0 | |
| man | fix CHANGES.md format for dune-release | |
| test | v0.4.0 | |
| .gitignore | v0.4.0 | |
| .ocamlformat | v0.4.0 | |
| CHANGES.md | fix CHANGES.md format for dune-release | |
| dune-project | add generated tbls.opam | |
| EXAMPLES.md | v0.4.0 | |
| LICENSE | v0.4.0 | |
| README.md | Update README.md | |
| tbls.opam | add generated tbls.opam | |
tbls
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 │
└───────┴───────┘
- See EXAMPLES.md for usage examples.
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.