https://github.com/linusu/rust-ansi-escapes
Ansi escape codes for Rust
https://github.com/linusu/rust-ansi-escapes
Last synced: 10 months ago
JSON representation
Ansi escape codes for Rust
- Host: GitHub
- URL: https://github.com/linusu/rust-ansi-escapes
- Owner: LinusU
- Created: 2016-11-01T18:49:55.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-06-23T20:31:17.000Z (about 2 years ago)
- Last Synced: 2025-01-02T00:32:24.641Z (over 1 year ago)
- Language: Rust
- Size: 17.6 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ANSI Escapes
[ANSI escape codes](http://www.termsys.demon.co.uk/vtansi.htm) for manipulating the terminal
## Usage
This example program will print "Hello, World!", then replace it with "Hello, Terminal!" after one second.
```rust
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](https://docs.rs/ansi-escapes)