Crates.io | ansi-escapes |
lib.rs | ansi-escapes |
version | 0.2.0 |
source | src |
created_at | 2016-11-01 19:32:35.232073 |
updated_at | 2024-06-23 20:31:10.656667 |
description | Ansi escape codes for manipulating the terminal |
homepage | https://github.com/LinusU/rust-ansi-escapes |
repository | https://github.com/LinusU/rust-ansi-escapes |
max_upload_size | |
id | 7099 |
size | 10,145 |
ANSI escape codes for manipulating the terminal
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);
}
See documentation