Package-level declarations

Types

Link copied to clipboard

One of the 8 basic colors supported by the ANSI standard.

Link copied to clipboard
sealed class AnsiColor
Link copied to clipboard
data class BrightColor(val baseColor: AnsiBaseColor) : AnsiColor

Bright variant of baseColor.

Link copied to clipboard

The default foreground or background color.

Link copied to clipboard

The default Style.

Link copied to clipboard
sealed class Document : PrettyPrintable

Represents a pretty printed document.

Link copied to clipboard
data class NormalColor(val baseColor: AnsiBaseColor) : AnsiColor

Normal variant of baseColor.

Link copied to clipboard
interface PrettyPrintable

An object that has a pretty text representation.

Link copied to clipboard
interface Style

A style describing how text should be printed on an ANSI terminal.

Functions

Link copied to clipboard

Like joined but using commas as separators and enclosed in curly braces.

Link copied to clipboard

Like joined but using commas as separators and enclosed in square brackets.

Link copied to clipboard

Like joined but using commas as separators and enclosed in /* and */.

Link copied to clipboard

Concatenates all the elements together with separators in between.

Link copied to clipboard

Concatenates this and other with a line break in between.

operator fun PrettyPrintable.div(other: String): Document

Convenience method. See plus.

Link copied to clipboard

Tries laying out this document into a single line by removing the contained Document.lineBreaks (and replacing them with spaces); if this does not fit the page, the document is laid out without any changes. This function is the key to layouts that adapt to available space nicely.

Link copied to clipboard
fun List<PrettyPrintable>.joined(separator: PrettyPrintable = Document(","), prefix: PrettyPrintable = Document(), postfix: PrettyPrintable = Document()): Document

Concatenates all the elements separated by separator and enclosed in prefix and postfix.

Link copied to clipboard
fun PrettyPrintable.nested(indentationChange: Int = 4): Document

Returns a new document that is this with the nesting level (indentation after newlines) increased by indentationChange. Negative values for indentationChange are allowed, and decrease the nesting level accordingly.

Link copied to clipboard

Concatenates this and other.

operator fun PrettyPrintable.plus(other: String): Document

Convenience method that automatically converts other to a Document.

Link copied to clipboard

Returns a new document that is this with style applied.

Link copied to clipboard

Concatenates this and other with a space in between.

operator fun PrettyPrintable.times(other: String): Document

Convenience method. See plus.

Link copied to clipboard

Like joined but using commas as separators and enclosed in parentheses.

Properties

Link copied to clipboard
const val DEFAULT_LINE_WIDTH: Int = 80

The maximum number of characters to put on one line.