Cringe (cringe v0.1.0)

Copy Markdown View Source

OTP-native terminal UI toolkit for Elixir.

Cringe builds terminal documents from plain Elixir data and renders them into terminal frames. The API is intentionally small while the package is early.

Summary

Functions

Renders a terminal document to a frame.

Renders a terminal document to a string.

Starts a supervised Cringe runtime.

Builds a text node.

Functions

box(first \\ [], second \\ [])

(macro)

column(first \\ [], second \\ [])

(macro)

frame(document, opts \\ [])

Renders a terminal document to a frame.

render(document, opts \\ [])

Renders a terminal document to a string.

iex> Cringe.text("hello") |> Cringe.render(width: 3)
"hel"

row(first \\ [], second \\ [])

(macro)

run(app, opts \\ [])

@spec run(
  module(),
  keyword()
) :: GenServer.on_start()

Starts a supervised Cringe runtime.

text(content, opts \\ [])

@spec text(
  IO.chardata(),
  keyword()
) :: Cringe.Document.Text.t()

Builds a text node.

iex> Cringe.text("hello")
%Cringe.Document.Text{content: "hello", opts: []}