Skip to content

io7m-com/tabla

Repository files navigation

tabla

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.tabla

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

tabla

Features

  • Unicode plain text table rendering.
  • Uses a generic constraint solver for table layouts.
  • Written in pure Java 21.
  • OSGi ready.
  • JPMS ready.
  • ISC license.
  • High-coverage automated test suite.

Building

$ mvn clean verify

Usage

var builder =
  Table.builder()
    .declareColumn("Item")
    .declareColumn("Description");

builder.addRow()
  .addCell("ca146625-5b90-4478-8ca3-51bce50f4d07")
  .addCell("Structural documentation.")

...
// Add more rows here.
...

var table =
  builder.build();

var lines =
  Tabla.framedUnicodeRenderer()
    .renderLines(table);

for (var line : lines) {
  System.out.println(line);
}
┌──────────────────────────────────────┬────────────────────────────────────────────┐
│ Item                                 │ Description                                │
├──────────────────────────────────────┼────────────────────────────────────────────┤
│ ca146625-5b90-4478-8ca3-51bce50f4d07 │ Structural documentation.                  │
├──────────────────────────────────────┼────────────────────────────────────────────┤
│ 8df7d45d-a6cd-4bd9-8e40-daa1f38d2835 │ A small jar containing a pickled beetroot. │
├──────────────────────────────────────┼────────────────────────────────────────────┤
│ 6253ab7f-2f0f-4961-9b9d-164b462da266 │ Assorted coat hangers.                     │
├──────────────────────────────────────┼────────────────────────────────────────────┤
│ 577cfd36-7d2d-41db-a9b9-cf4d4ced9160 │ A silver, decorative clock.                │
└──────────────────────────────────────┴────────────────────────────────────────────┘