4 releases
new 0.2.5 | May 12, 2024 |
---|---|
0.2.4 | May 12, 2024 |
0.2.3 | Apr 28, 2024 |
#204 in Command-line interface
621 downloads per month
21KB
401 lines
Installation
From crates.io:
cargo add ruterm
From repository (more recent):
cargo add --git https://github.com/georgiyozhegov/terminal.git
Warning: Currently, supports only Linux.
Usage
use ruterm::{
error::Result,
in_raw,
style::{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.as_bytes())?; // green foreground
write(b"Hello from raw mode!\n\r")?;
write(RESET.as_bytes())?; // reset style
cursor::set(0, h)?; // move cursor to the bottom
});
Ok(())
}
Examples
cargo run --example car
References
Dependencies
~120KB