View Source Boxen.Helpers (boxen v0.1.0)

Helpers for manipulating text

Link to this section Summary

Functions

Gets the terminal columns

Helper method to print the directly print the result

Removes emojis from text and replace it with 2 blank spaces

Stripes ANSI characters from text

Gets the length of widest line in a text

Link to this section Functions

Link to this function

ansi_align_text(text, alignment)

View Source
@spec ansi_align_text(text :: String.t(), alignment :: :left | :right | :center) ::
  String.t()

Aligns a text

@spec get_terminal_columns() :: pos_integer()

Gets the terminal columns

@spec remove_emoji(text :: String.t()) :: String.t()

Removes emojis from text and replace it with 2 blank spaces

@spec strip_ansi(text :: String.t()) :: String.t()

Stripes ANSI characters from text

Link to this function

text_representation_length(text)

View Source
@spec text_representation_length(text :: String.t()) :: non_neg_integer()
@spec widest_line(text :: String.t()) :: non_neg_integer()

Gets the length of widest line in a text