View Source Tio (Tío v1.0.0)

A few helpful functions for terminal I/O. Read more in the readme.

  • step should be used to show a group of actions is about to start
  • action should be used to show an action is starting
  • info should be used to show any important information from an action
  • done should be used to show a group of steps is done

Steps and actions can take blocks:

Tio.step "Rethreading flux capacitor" do
  Tio.action "Initializing agitator" do
    Tio.info("3... 2... 1...")
  end

  Tio.action "Regulating coherence" do
    Tio.info("0.5... 0.75... 1.0")
  end
end
Tio.done()

Messages can be iodata (strings, lists, or improper lists) and are ultimately formatted with IO.ANSI.format/2. One addition is that if a message is a list, then a {:quoted, message} tuple will be formatted in the quote color:

Tio.info(["File ", {:quoted, "foo.txt"}, " has ", {:quoted, "20"}, " lines"])

Link to this section Summary

Functions

Prints message describing an action that's about to start

Prints a message indicating that all steps and actions are done

Prints informational message message

Prints message describing a step that's about to start

Link to this section Functions

Specs

action(message :: iodata()) :: :ok

Prints message describing an action that's about to start

Link to this macro

action(message, list)

View Source (macro)

Specs

done() :: :ok

Prints a message indicating that all steps and actions are done

Specs

info(message :: iodata()) :: :ok

Prints informational message message

Specs

step(message :: iodata()) :: :ok

Prints message describing a step that's about to start

Link to this macro

step(message, list)

View Source (macro)