7 releases

new 0.3.1 May 25, 2024
0.3.0 May 24, 2024
0.2.7 May 23, 2024
0.2.3 Apr 28, 2024

#213 in Command-line interface

Download history 224/week @ 2024-04-21 134/week @ 2024-04-28 2/week @ 2024-05-05 292/week @ 2024-05-12 297/week @ 2024-05-19

725 downloads per month

MIT license

20KB
386 lines

Ruterm

Tiny (~400 loc) library for working with the terminal

docs.rs crates.io GitHub License GitHub code size in bytes

Examples

Usage

use ruterm::{
    error::Result,
    in_raw,
    view::{color::fore, RESET},
    io::write,
    size,
    cursor,
};

fn main() -> Result<()> {
    in_raw!({
        cursor::start()?; // clear screen
        let (w, h) = size()?;
        cursor::set(w / 2, h / 2)?; // move cursor to the center
        write(fore::GREEN)?; // green foreground
        write("Hello from raw mode!\n\r")?;
        write(RESET)?; // reset style
        cursor::set(0, h)?; // move cursor to the bottom
    });

    Ok(())
}

Installation

From crates.io:

cargo add ruterm

From repository (more recent):

cargo add --git https://github.com/georgiyozhegov/ruterm.git

Warning: Currently, supports only Linux.

References

Dependencies

~120KB