11 releases (4 breaking)
Uses old Rust 2015
0.14.0 | Aug 7, 2017 |
---|---|
0.13.0 | Aug 2, 2017 |
0.12.5 | Jul 26, 2017 |
0.12.3 | Jun 17, 2017 |
0.10.0 | May 6, 2017 |
#658 in Command-line interface
Used in 2 crates
145KB
3.5K
SLoC
tinf
A low-level interface to terminfo databases.
Usage
Add this to your Cargo.toml
:
[dependencies]
tinf = "0.14.0"
and this to your crate root:
extern crate tinf;
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.
let stdout = &mut std::io::stdout();
let mut vars = Vars::new();
tparm(stdout, &desc[setaf], &mut params!(1), &mut vars)?;
lib.rs
:
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.