View Source Credo.CLI.Output.UI (Credo v1.7.7-rc.0)

This module provides functions used to create the UI.

>>> alias Credo.CLI.Output.UI
>>> UI.puts "This is a test."
This is a test.
nil

>>> alias Credo.CLI.Output.UI
>>> UI.warn "This is a warning."
This is a warning.
nil

Summary

Functions

Returns the edge () which is used in much of Credo's output as a binary.

See Credo.CLI.Output.Shell.puts/0.

See Credo.CLI.Output.Shell.puts/1.

Truncate a line to fit within a specified maximum length. Truncation is indicated by a trailing ellipsis (…), and you can override this using an optional third argument.

See Credo.CLI.Output.Shell.warn/1.

Functions

Returns the edge () which is used in much of Credo's output as a binary.

Link to this function

edge(color, indent \\ 2)

View Source

See Credo.CLI.Output.Shell.puts/0.

See Credo.CLI.Output.Shell.puts/1.

Link to this function

puts_edge(color, indent \\ 2)

View Source
Link to this function

truncate(line, max_length)

View Source

Truncate a line to fit within a specified maximum length. Truncation is indicated by a trailing ellipsis (…), and you can override this using an optional third argument.

iex> Credo.CLI.Output.UI.truncate(nil, 7)
""
iex> Credo.CLI.Output.UI.truncate("  7 chars\n", 7)
"  7 ch…"
iex> Credo.CLI.Output.UI.truncate("  more than 7\n", 7)
"  more…"
iex> Credo.CLI.Output.UI.truncate("  more than 7\n", 7, " ...")
"  m ..."
Link to this function

truncate(line, max_length, ellipsis)

View Source

See Credo.CLI.Output.Shell.warn/1.