Terminal information for Rust.

Overview

terminfo

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

() { io::stdout().write_all(&flash.expand(&[], &mut Default::default()).unwrap()).unwrap(); } else { println!("FLASH GORDON!"); } }">
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::
   () {
    
   println!(
   "The terminal supports {} colors.", n);
  }
  
   else {
    
   println!(
   "The terminal does not support colors, what year is this?");
  }

  
   if 
   let 
   Some(flash) 
   = info.
   get
   ::
   
    () {
    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.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
⚡ An extremely fast cross-compatible system information tool.

Lightfetch A extremely fast command-line system information tool written in Rust ⚡ . Gallery Sadly there isn't much to showcase right now. Download Av

⚡ An extremely fast cross-compatible system information tool.

Lightfetch A extremely fast command-line system information tool written in Rust ⚡ . Gallery Sadly there isn't much to showcase right now. Download Av

A cross-platform library for retrieving information about connected devices.

Devices devices is a cross-platform library for retrieving information about connected devices. Combined with a library like sysinfo, a more or less c

Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded.

Safer Nostr is a service that helps protect users by loading sensitive information (IP leak) and using AI to prevent inappropriate images from being uploaded. It also offers image optimization and storage options. It has configurable privacy and storage settings, as well as custom cache expiration.

Command-line System Information Tool
Command-line System Information Tool

A blazingly fast system fetch program to pair with onefetch View the complete ascii art collection at punfetch.dev Installation Install from crates.io

This library contains collection of all sorts of useful information for every country.

Keshvar This library contains collection of all sorts of useful information for every country. Package | Documentation | Repository Demo use keshvar::

Sniffer - a tool to quickly inspect csv and flat-file files for basic information
Sniffer - a tool to quickly inspect csv and flat-file files for basic information

sniffer sniffer is a tool to quickly inspect csv and flat-file files for basic information. Need to see how many rows are in a csv file? Want to see t

Web-based tool that allows browsing and comparing symbol and type information of Microsoft Windows binaries across different versions of the OS.
Web-based tool that allows browsing and comparing symbol and type information of Microsoft Windows binaries across different versions of the OS.

WinDiff About WinDiff is an open-source web-based tool that allows browsing and comparing symbol and type information of Microsoft Windows binaries ac

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.
Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Owner
null
Github user information on terminal :D

octofetch Use this if youre too lazy to open github lol Installation Local install with cargo Run cargo install --git https://github.com/azur1s/octofe

Natapat Samutpong 65 Nov 2, 2022
Rust-battery - Rust crate providing cross-platform information about the notebook batteries.

battery Rust crate providing cross-platform information about the notebook batteries. Table of contents Overview Supported platforms Install Examples

svartalf 326 Dec 21, 2022
A terminal ASCII media player. View images, gifs, videos, webcam, YouTube, etc.. directly in the terminal as ASCII art.

Terminal Media Player View images, videos (files or YouTube links), webcam, etc directly in the terminal as ASCII. All images you see below are just m

Max Curzi 36 May 8, 2023
ask.sh: AI terminal assistant that can read and write your terminal directly!

ask.sh: AI terminal assistant that read from & write to your terminal ask.sh is an AI terminal assistant based on OpenAI APIs such as GPT-3.5/4! What'

hmirin 5 Jun 20, 2023
A simple and efficient terminal UI implementation with ratatui.rs for getting quick insights from csv files right on the terminal

CSV-GREP csv-grep is an intuitive TUI application writting with ratatui.rs for reading, viewing and quickly analysing csv files right on the terminal.

Anthony Ezeabasili 16 Mar 10, 2024
skyfetch ☁️ a system information fetch written in rust

skyfetch ☁️ a system information fetch written in rust requirements cargo install with curl

leo. 31 Dec 15, 2022
Are we lang yet? A simple website providing information about the status of Rust's language development ecosystem.

Are We Lang Yet This project answers the question "Is the Rust ecosystem ready to use for language development yet?". arewelangyet.com What is this? C

null 8 Dec 7, 2022
Binary Ninja plugin written in Rust to automatically apply symbol information from split debug info on Linux.

Load Symbols Binary Ninja plugin written in Rust to automatically apply symbol information from split debug info on Linux. Requirements Last tested wi

null 4 Jul 20, 2022
A utility written in Rust for dumping binary information out of Mach-O files inspired by objdump

Mach-O Dump (macho-dump) An objdump like tool for exploring and manipulating Mach-O files. Note: This project is in an early stage and most of the fea

Irides 2 Oct 17, 2022
Macchina - A system information frontend, with an (unhealthy) emphasis on performance.

macchina Fast, minimal and customizable system information frontend. Linux • macOS • Windows • NetBSD • FreeBSD • OpenWrt • Android About macchina let

Macchina CLI 682 Jan 5, 2023