All Projects → meh → rust-terminfo

meh / rust-terminfo

Licence: other
Terminal information for Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-terminfo

croatoan
Common Lisp bindings for the ncurses terminal library.
Stars: ✭ 111 (+404.55%)
Mutual labels:  terminfo, ncurses
swirc
Lightweight terminal based ICB and IRC client
Stars: ✭ 20 (-9.09%)
Mutual labels:  ncurses
ncurses guide
NCurses Examples from the book "Programmer's Guide to NCurses" with improvements and fixes
Stars: ✭ 43 (+95.45%)
Mutual labels:  ncurses
csol
A small collection of solitaire/patience games (Klondike, FreeCell, Spider, Yukon, etc.) to play in the terminal
Stars: ✭ 25 (+13.64%)
Mutual labels:  ncurses
AsciiBird
ASCII version of the addictive Flappy Bird game.
Stars: ✭ 34 (+54.55%)
Mutual labels:  ncurses
ShiTTYchat
A bare-bones terminal chat room.
Stars: ✭ 24 (+9.09%)
Mutual labels:  ncurses
noaftodo
NOAFtodo - an ncurses TODO-manager No One Asked For
Stars: ✭ 15 (-31.82%)
Mutual labels:  ncurses
mous
Lightweight audio player & converter for FreeBSD/Linux/macOS
Stars: ✭ 65 (+195.45%)
Mutual labels:  ncurses
ncgrep
NCGREP, which is based on ncurses library to provide user interface, is a grep tool for searching text on target directory.
Stars: ✭ 23 (+4.55%)
Mutual labels:  ncurses
cxxcurses
Header only ncurses wrapper
Stars: ✭ 24 (+9.09%)
Mutual labels:  ncurses
tput.cr
Low-level component for building term/console applications in Crystal
Stars: ✭ 22 (+0%)
Mutual labels:  terminfo
MiniGBS
Small .gbs chiptune player for Linux
Stars: ✭ 15 (-31.82%)
Mutual labels:  ncurses
spotify-terminal
Terminal application to play/control Spotify.
Stars: ✭ 61 (+177.27%)
Mutual labels:  ncurses
ncurses
Ncurses bindings for Crystal
Stars: ✭ 20 (-9.09%)
Mutual labels:  ncurses
ctodo
A simple ncurses-based tasklist manager
Stars: ✭ 31 (+40.91%)
Mutual labels:  ncurses
mazeGenerator
Recursive Backtracker Maze Generation Algorithm with C++ using ncurses
Stars: ✭ 24 (+9.09%)
Mutual labels:  ncurses
ngp
Ncurses code parsing tool
Stars: ✭ 52 (+136.36%)
Mutual labels:  ncurses
tide
Minimal Transmission CLI client
Stars: ✭ 49 (+122.73%)
Mutual labels:  ncurses
ngputop
Yet another ncurses GPU utilization monitor inspired by htop
Stars: ✭ 21 (-4.55%)
Mutual labels:  ncurses
vtGBte
A simple GameBoy tile editor written in C using ncurses
Stars: ✭ 25 (+13.64%)
Mutual labels:  ncurses

terminfo

Crates.io Crates.io WTFPL Build Status

Terminal capabilities with type-safe getters.

Usage

Add this to your Cargo.toml:

[dependencies]
terminfo = "0.1"

and this to your crate root:

extern crate terminfo;

Example

extern crate terminfo;

use std::io::{self, Write};
use terminfo::{Expand, Database, capability as cap};

fn main() {
  let info = Database::from_env().unwrap();

  if let Some(cap::MaxColors(n)) = info.get::<cap::MaxColors>() {
    println!("The terminal supports {} colors.", n);
  }
  else {
    println!("The terminal does not support colors, what year is this?");
  }

  if let Some(flash) = info.get::<cap::FlashScreen>() {
    io::stdout().write_all(&flash.expand(&[], &mut Default::default()).unwrap()).unwrap();
  }
  else {
    println!("FLASH GORDON!");
  }
}

Packaging and Distributing

For all terminals but windows consoles, this library depends on a non-hashed (for now) terminfo database being present. For example, on Debian derivitives, you should depend on ncurses-term; on Arch Linux, you depend on ncurses; and on MinGW, you should depend on mingw32-terminfo.

Unfortunately, if you're using a non-windows console on Windows (e.g. MinGW, Cygwin, Git Bash), you'll need to set the TERMINFO environment variable to point to the directory containing the terminfo database.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].