example_files v1.0.0 ExampleFiles.UI

Provides functions for stdout/stderr output and ANSI escape-sequence formatting.

Summary

Types

A UI display stream

Functions

Determines if the UI process automatically displays content provided to info/2 and error/2. Inspect this property, without changing its value, using autoflush?/2

Returns true if the UI process automatically displays content provided to info/2 and error/2. Change this property using autoflush/3

Formats ansi_data with its foreground in blue

Prints ansi_data to the stderr stream, or appends it to the cache if autoflush?/2 is false. Returns the string printed, or nil

Prints ansi_data to the stderr stream, or inserts it in the cache at the specified location if autoflush?/2 is false. Returns the string printed, or nil

Formats ansi_data with its foreground in green

Prints ansi_data to the stdout stream, or appends it to the cache if autoflush?/2 is false. Returns the string printed, or nil

Prints ansi_data to the stdout stream, or inserts it in the cache at the specified location if autoflush?/2 is false. Returns the string printed, or nil

Formats ansi_data with its foreground in red

Starts an ExampleFiles.UI process, linked to the current process, with the specified autoflush option

Formats ansi_data with underlining

Formats ansi_data with its foreground in yellow

Types

stream()
stream() :: :error | :info

A UI display stream.

Functions

autoflush(ui, value, timeout \\ 5000)
autoflush(GenServer.server, boolean, timeout) :: boolean

Determines if the UI process automatically displays content provided to info/2 and error/2. Inspect this property, without changing its value, using autoflush?/2.

Examples

iex> {:ok, ui} = ExampleFiles.UI.start_link
...> ui |> ExampleFiles.UI.autoflush(false)
...> ui |> ExampleFiles.UI.autoflush?
false
autoflush?(ui, timeout \\ 5000)
autoflush?(GenServer.server, timeout) :: boolean

Returns true if the UI process automatically displays content provided to info/2 and error/2. Change this property using autoflush/3.

Examples

iex> {:ok, ui} = ExampleFiles.UI.start_link
...> ui |> ExampleFiles.UI.autoflush?
true
blue(ansi_data)

Formats ansi_data with its foreground in blue.

error(ui, ansi_data \\ "", timeout \\ 5000)
error(GenServer.server, IO.ANSI.ansidata, timeout) :: binary

Prints ansi_data to the stderr stream, or appends it to the cache if autoflush?/2 is false. Returns the string printed, or nil.

error_insert_at(ui, index, ansi_data \\ "", timeout \\ 5000)
error_insert_at(GenServer.server, integer, IO.ANSI.ansidata, timeout) :: binary

Prints ansi_data to the stderr stream, or inserts it in the cache at the specified location if autoflush?/2 is false. Returns the string printed, or nil.

flush(ui, timeout \\ 5000)
flush(GenServer.server, timeout) :: [{stream, binary}]
green(ansi_data)

Formats ansi_data with its foreground in green.

info(ui, ansi_data \\ "", timeout \\ 5000)
info(GenServer.server, IO.ANSI.ansidata, timeout) :: binary

Prints ansi_data to the stdout stream, or appends it to the cache if autoflush?/2 is false. Returns the string printed, or nil.

info_insert_at(ui, index, ansi_data \\ "", timeout \\ 5000)
info_insert_at(GenServer.server, integer, IO.ANSI.ansidata, timeout) :: binary

Prints ansi_data to the stdout stream, or inserts it in the cache at the specified location if autoflush?/2 is false. Returns the string printed, or nil.

red(ansi_data)

Formats ansi_data with its foreground in red.

start_link(arguments \\ [], options \\ [])
start_link([{:autoflush, boolean}], [{atom, any}]) :: GenServer.on_start

Starts an ExampleFiles.UI process, linked to the current process, with the specified autoflush option.

underline(ansi_data)

Formats ansi_data with underlining.

yellow(ansi_data)

Formats ansi_data with its foreground in yellow.