UI.Output behaviour (fnord v0.8.83)

View Source

Behaviour for UI output operations.

This abstraction allows different implementations for production (UI.Queue/Owl.IO) and testing (simple IO that can be captured).

Summary

Callbacks

box(iodata, keyword)

@callback box(
  iodata(),
  keyword()
) :: :ok

choose(t, list)

@callback choose(String.t(), list()) :: any()

choose(t, list, non_neg_integer, any)

@callback choose(String.t(), list(), non_neg_integer(), any()) :: any()

confirm(t)

@callback confirm(String.t()) :: boolean()

confirm(t, boolean)

@callback confirm(String.t(), boolean()) :: boolean()

flush()

@callback flush() :: :ok

interact(function)

@callback interact((-> any())) :: any()

log(atom, iodata)

@callback log(atom(), iodata()) :: :ok

newline()

@callback newline() :: :ok

prompt(t)

@callback prompt(String.t()) :: String.t() | {:error, atom()}

prompt(t, keyword)

@callback prompt(
  String.t(),
  keyword()
) :: String.t() | {:error, atom()}

puts(iodata)

@callback puts(iodata()) :: :ok