View Source API Reference Tux v0.4.0

Modules

Tux

Terminal User Experience

An alert is a struct which encodes the textual and formatting information which can be used to display stylized error messages.

Alertable protocol is used by Tux.Show to display command error results in a user-friendly fashion using the Tux.Alert struct.

Utility macros to generate test cases for dispatchers or main escript modules.

Basic functions wrapping a few IO.ANSI coloring functions for writing stylized output to the terminal.

A command module provides the implementation for a given command, and it can be registered on a given dispatcher using the Tux.Dispatcher.cmd/2 macro.

Basic support for reading and writing key = value configuration files, with support for ignoring comment lines (lines that start with # or ;).

Dispatchers are modules which control program flow by directing the command execution to the appropriate command module in response to a given command/sub-command invoked by the CLI's end user.

The environment struct contains the information required by a dispatcher to execute the logic associated with a given CLI command, while also being the first argument to be passed to a command module's Tux.Command.main callback.

Construct custom exception modules which automatically derive the Tux.Alertable protocol. The generated error type will have the following fields

Errors raised or returned by various tux components.

Dispatcher subystem for invoking command modules, with optional rescuing from raised exceptions.

Routines for stopping the VM with an appropriate exit code from command modules.

Create beautiful looking, well-structured help messages for commands or dispatchers.

Dispatcher subsystem used internally for initialization of command environment and collection of preload results prior to command execution.

Find the command module for a given command name.

Helper functions for retrieving user input as: strings, integers, floats or for asking for confirmations.

Utility macros for generating hierarchical, compact skeletons of simple programs used for testing purposes without going the traditional route of creating the modules with Tux.Dispatcher, Tux.Command, etc.

The tux result is the standard result type which must be returned by a command module, which controls what the CLI's end-user sees as output.

This module is responsible for converting the Tux.Result returned by a command module to a string representation, and then sending it to the device (by default the :stdio) defined in the Tux.Env struct.