Cowrie.Transforms (cowrie v0.4.0)

Defines functions that transform (a.k.a. mutate) text. These functions do not print the text and they do not apply ANSI formatting.

Summary

Functions

Prepends a Danger emoji to the given text.

Prepends an Info emoji to the given text.

Prepends a Success emoji to the given text.

Prepends a Warning emoji to the given text.

Appends a newline to the text.

Draws a box around the given text. The text must be less than one line and it should not contain newlines.

Centers the given text using the configured column width (:cols)

Creates a horizontal line

Formats a list item for an ordered list by applying the :n character.

Prepends a newline to the text.

Formats a list item for an unordered list by applying the :li_bullet character.

Functions

alert_danger(text, opts)

Prepends a Danger emoji to the given text.

alert_info(text, opts)

Prepends an Info emoji to the given text.

alert_success(text, opts)

Prepends a Success emoji to the given text.

alert_warning(text, opts)

Prepends a Warning emoji to the given text.

append_newline(text, opts)

Appends a newline to the text.

box(text, opts \\ [])

Draws a box around the given text. The text must be less than one line and it should not contain newlines.

Available configuration:

:box_chars - a map with keys containing for the top(t), top-right(tr), right (right), bottom-right (br), bottom (b), bottom-left (bl), left (l), and top-left (tl) characters to be used when drawing the box.

Default:

  %{
    t: "═",
    tr: "╗",
    r: "║",
    br: "╝",
    b: "═",
    bl: "╚",
    l: "║",
    tl: "╔"
  }

:box_padding - integer representing the number of columns of empty space between the box's left and right borders and the text, default: 1

capitalize(text, opts \\ [])

A wrapper for String.capitalize/2

center(text, opts \\ [])

Centers the given text using the configured column width (:cols)

downcase(text, opts)

A wrapper for String.downcase/2

hr(char, opts)

Creates a horizontal line

ol_li(text, opts)

Formats a list item for an ordered list by applying the :n character.

prepend_newline(text, opts)

Prepends a newline to the text.

ul_li(text, opts)

Formats a list item for an unordered list by applying the :li_bullet character.

upcase(text, opts)

A wrapper for String.upcase/2