Crate tinf

Source
Expand description

A low-level interface to terminfo databases.

§Usage

To find and read terminal descriptions, see Desc; to send commands to a terminal, see tparm and tputs.

§Examples

use tinf::{Desc, tparm, Vars};

// Find the description for "xterm" in the default locations.
let mut file = Desc::file("xterm")?;

// Parse it into a `Desc` object.
let desc = Desc::parse(&mut file)?;

// Send the escape sequence to set foreground to red.
use tinf::cap::setaf;
let stdout = &mut std::io::stdout();
let mut vars = Vars::new();
tparm(stdout, &desc[setaf], &mut params!(1), &mut vars)?;

§Platform Compatibility

This requires a local terminfo database in directory tree format; it will not work with a hashed database. In other words, it should Just Work on Linux/OSX/Cygwin, but it might not work out of the box on BSD operating systems.

Modules§

cap
Terminfo capability names.

Macros§

desc
A syntax for Desc literals.
params
Parameter list syntax for tparm.

Structs§

CapError
An error that occurred while preparing or printing a string capability.
Desc
The names and capabilities that make up a terminal description.
DescError
An error that occurred while finding or parsing a terminal description.
Vars
Variables for tparm.

Enums§

Param
A parameter for tparm.

Functions§

tparm
Print a string capability, interpolating parameters.
tputs
Print a string capability, applying padding.