View Source Tux.Alert (Tux v0.4.0)
An alert is a struct which encodes the textual and formatting information which can be used to display stylized error messages.
Examples
Please be aware that the colored and embolden parts cannot be seen in this example, nonetheless an alert in its simplest version looks roughly something like this:
│ ERR: Command error
And with additional details:
│ ERR: Command error
│
│ This section has more details about the error.
Summary
Types
Functions
Set or update a given alert field.
Examples
iex> alias Tux.Alert
...>
...> Alert.new()
...> |> Alert.add(:tag, "ERR")
...> |> Alert.add(:color, &Tux.Colors.red/1)
...> |> Alert.add(:title, "Title")
...> |> Alert.add(:message, "Message")
%Tux.Alert{color: &Tux.Colors.red/1, message: "Message", tag: "ERR", title: "Title"}
@spec new() :: t()
Return a blank alert struct
Examples
iex> Tux.Alert.new()
%Tux.Alert{tag: nil, color: nil, title: nil, message: nil}