Escritoire is a simple library for printing tabular data in monospaced fonts, typically for use in console applications.
- prints data using Unicode box-drawing characters
- supports multiline cells
- cell contents may be left, right or centrally aligned
- compact display for tables which don't include multiline contents
The current latest release of Escritoire is 0.4.0.
Creating a table to be displayed in a monospaced font (e.g. for rendering in a console) is easy,
and first requires a
Tabulation instance to be defined, specifying each column and how it should
case class Person(name: String, age: Int, active: Boolean) val table = Tabulation[Person]( Column("Name", _.name), Column("Age", _.age), Column("Active", p => if p.active then "Yes" else "No") )
describes a table of three columns,
Active, defined for rows of type
where the content for each column is defined by a lambda, such as
_.age. The return
types of these lambdas are any types which can be rendered as
AnsiStrings. In other words, any
type for which an
AnsiShow instance exists.
Given such a definition, any collection of instances of
ps, can be rendered as a table
Seq[String] of each output line) of maximum width
width by calling
val persons = List(Person("Bill", 48, true), Person("Janet", 54, false)) table.tabulate(100, persons)
will return a sequence of
Strings which will print as,
┌───────┬─────┬────────┐ │ Name │ Age │ Active │ ├───────┼─────┼────────┤ │ Bill │ 48 │ Yes │ │ Janet │ 54 │ No │ └───────┴─────┴────────┘
The following Scala One libraries are dependencies of Escritoire:
The following Scala One libraries are dependents of Escritoire:
Escritoire is classified as fledgling. Propensive defines the following five stability levels for open-source projects:
- embryonic: for experimental or demonstrative purposes only, without any guarantees of longevity
- fledgling: of proven utility, seeking contributions, but liable to significant redesigns
- maturescent: major design decisions broady settled, seeking probatory adoption and refinement
- dependable: production-ready, subject to controlled ongoing maintenance and enhancement; tagged as version
- adamantine: proven, reliable and production-ready, with no further breaking changes ever anticipated
Escritoire is designed to be small. Its entire source code currently consists of 200 lines of code.
Escritoire can be built on Linux or Mac OS with Irk, by running the
irk script in the root directory:
This script will download
irk the first time it is run, start a daemon process, and run the build. Subsequent
invocations will be near-instantaneous.
We suggest that all contributors read the Contributing Guide to make the process of contributing to Escritoire easier.
Please do not contact project maintainers privately with questions. While it can be tempting to repsond to such questions, private answers cannot be shared with a wider audience, and it can result in duplication of effort.
Escritoire was designed and developed by Jon Pretty, and commercial support and training is available from Propensive OÜ.
Escritoire is a pun: it is named after a type of writing table, since its purpose is for writing tables.
Escritoire is copyright © 2018-22 Jon Pretty & Propensive OÜ, and is made available under the Apache 2.0 License.