Awesome
tabl
Make tables from data in your terminal.
Install
Download the latest from the releases page.
Usage
This small utility takes JSON or EDN files with multiple maps and creates a table for ease of viewing. For example:
$ cat test.json
{"foo":"bar","baz":4}
{"foo":"oof","baz":4}
$ cat test.json | tabl -j
:baz | :foo
------|------
4 | bar
4 | oof
There are several table rendering modes available:
library | modes |
---|---|
fancy | fancy |
doric | org, csv, html, raw |
built-in | md, k8s |
$ cat test.json | tabl -j -m org
|-----+-----|
| Foo | Baz |
|-----+-----|
| bar | 4 |
| oof | 4 |
|-----+-----|
Babashka pod support
The following namespaces and functions are exposed via the pod interface:
pod.tabl.fancy
(see here for more information)render-table
- returns table as a list of stringsprint-table
- prints a table based on data
pod.tabl.doric
table
- returns table as a list of strings (see here for more information)print-table
- prints a table based on data
Example:
#!/usr/bin/env bb
(require '[babashka.pods :as pods])
(pods/load-pod "tabl")
(require '[pod.tabl.fancy :as fancy])
(require '[pod.tabl.doric :as doric])
;;
(fancy/print-table [{:foo 1 :bar 2} {:foo 2 :bar 3}])
(doric/print-table [{:foo 1 :bar 2} {:foo 2 :bar 3}])
(doric/print-table {:format 'doric.org} [{:foo 1 :bar 2} {:foo 2 :bar 3}])
See pod_test.clj for more examples.
Development
Not quite ready yet. This depends on a soon-to-be-released library.
Thank you to Michiel Borkent and Lee Read for spearheading the GraalVM efforts, documented here.
License
Copyright © 2019-2022 Nate Jones
Distributed under the EPL License. See LICENSE.
This project contains code from:
babashka, which is licensed under the same EPL License.