3 unstable releases
0.2.0 | Jun 23, 2024 |
---|---|
0.1.1 | Aug 6, 2021 |
0.1.0 | Nov 1, 2016 |
#109 in Command-line interface
26,532 downloads per month
Used in 21 crates
(12 directly)
10KB
141 lines
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