ansi-escapes

Crates.ioansi-escapes
lib.rsansi-escapes
version0.2.0
created_at2016-11-01 19:32:35.232073+00
updated_at2024-06-23 20:31:10.656667+00
descriptionAnsi escape codes for manipulating the terminal
homepagehttps://github.com/LinusU/rust-ansi-escapes
repositoryhttps://github.com/LinusU/rust-ansi-escapes
max_upload_size
id7099
size10,145
Linus Unnebäck (LinusU)

documentation

https://docs.rs/ansi-escapes

README

ANSI Escapes

ANSI escape codes for manipulating the terminal

Usage

This example program will print "Hello, World!", then replace it with "Hello, Terminal!" after one second.

extern crate ansi_escapes;

use std::thread::sleep;
use std::time::Duration;

fn main() {
    // Hides the cursor
    print!("{}", ansi_escapes::CursorHide);

    // Prints first message
    println!("Hello, World!");

    // Waits one seconds
    sleep(Duration::from_secs(1));

    // Erases the two lines
    print!("{}", ansi_escapes::EraseLines(2));

    // Print final message
    println!("Hello, Terminal!");

    // Shows the cursor
    print!("{}", ansi_escapes::CursorShow);
}

API

See documentation

Commit count: 12

cargo fmt