t2

Utility for text tables

License

License

GroupId

GroupId

com.github.losizm
ArtifactId

ArtifactId

t2_2.13
Last Version

Last Version

0.4.1
Release Date

Release Date

Type

Type

jar
Description

Description

t2
Utility for text tables
Project URL

Project URL

https://github.com/losizm/t2
Project Organization

Project Organization

com.github.losizm
Source Code Management

Source Code Management

https://github.com/losizm/t2

Download t2_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.losizm/t2_2.13/ -->
<dependency>
    <groupId>com.github.losizm</groupId>
    <artifactId>t2_2.13</artifactId>
    <version>0.4.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.losizm/t2_2.13/
implementation 'com.github.losizm:t2_2.13:0.4.1'
// https://jarcasting.com/artifacts/com.github.losizm/t2_2.13/
implementation ("com.github.losizm:t2_2.13:0.4.1")
'com.github.losizm:t2_2.13:jar:0.4.1'
<dependency org="com.github.losizm" name="t2_2.13" rev="0.4.1">
  <artifact name="t2_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.losizm', module='t2_2.13', version='0.4.1')
)
libraryDependencies += "com.github.losizm" % "t2_2.13" % "0.4.1"
[com.github.losizm/t2_2.13 "0.4.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.5

test (1)

Group / Artifact Type Version
org.scalatest : scalatest-flatspec_2.13 jar 3.2.5

Project Modules

There are no modules declared in this project.

t2

Utility for text tables.

Maven Central

Getting Started

Add t2 as a dependency to your project:

libraryDependencies += "com.github.losizm" %% "t2" % "0.4.1"

Usage

Below is an example of t2 in action. Here it builds a table and writes the content to stdout.

// Build table with first row as table header
val table = t2.TableBuilder()
  .add("#", "Effective Date", "Currency Code", "Exchange Rate")
  .add("1", "2021-01-04", "USD", "0.690236")
  .add("2", "2021-01-05", "USD", "0.690627")
  .add("3", "2021-01-06", "USD", "0.689332")
  .build()

// Create table writer with supplied configuration
val writer = t2.TableWriter(
  "ansiColorEnabled" -> "true",
  "tableBorderColor" -> "cyan",
  "tableHeaderColor" -> "black,yellowBackground",
  "bodyRuleColor"    -> "yellow",
  "rowHeaderEnabled" -> "true",
  "rowHeaderColor"   -> "bold,cyan",
  "columnRightAlign" -> "0,3" // Right align first and last columns
)

// Write table to stdout
writer.write(System.out, table)

The generated output would look something like the following if printed to a color-enabled terminal.

Table output can be restyled using configuration for such things as changing cell padding, character used for table borders, and more.

API Documentation

See scaladoc for additional details.

License

t2 is licensed under the Apache License, Version 2. See LICENSE file for more information.

Versions

Version
0.4.1
0.4.0
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0