Cringe (cringe v0.4.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.

Builds a render-only text input widget.

Builds a render-only progress bar widget.

Renders a terminal document to a string.

Starts a Cringe runtime process linked to the caller.

Starts a supervisor that owns a Cringe runtime process.

Builds a render-only select/list widget.

Builds a render-only spinner widget.

Builds a text node.

Functions

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

(macro)

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

(macro)

frame(document, opts \\ [])

Renders a terminal document to a frame.

input(opts \\ [])

@spec input(keyword()) :: Cringe.Document.t()

Builds a render-only text input widget.

progress(opts \\ [])

@spec progress(keyword()) :: Cringe.Document.t()

Builds a render-only progress bar widget.

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 Cringe runtime process linked to the caller.

run_supervised(app, opts \\ [])

@spec run_supervised(
  module(),
  keyword()
) :: Supervisor.on_start()

Starts a supervisor that owns a Cringe runtime process.

select(opts \\ [])

@spec select(keyword()) :: Cringe.Document.t()

Builds a render-only select/list widget.

spinner(opts \\ [])

@spec spinner(keyword()) :: Cringe.Document.t()

Builds a render-only spinner widget.

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: []}