https://github.com/georgiyozhegov/ruterm
Tiny library for working with the terminal.
https://github.com/georgiyozhegov/ruterm
library rust simple terminal
Last synced: 2 months ago
JSON representation
Tiny library for working with the terminal.
- Host: GitHub
- URL: https://github.com/georgiyozhegov/ruterm
- Owner: georgiyozhegov
- License: mit
- Created: 2024-03-15T18:09:29.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-12T11:25:22.000Z (over 1 year ago)
- Last Synced: 2025-09-22T05:25:37.859Z (7 months ago)
- Topics: library, rust, simple, terminal
- Language: Rust
- Homepage:
- Size: 184 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-with-stars - ruterm - 07-16 | (Libraries / Command-line)
README
Ruterm
Tiny (~400 loc) library for working with the terminal
[](https://docs.rs/ruterm/latest/ruterm/)
[](https://crates.io/crates/ruterm)


# Examples

# Usage
```rust
use ruterm::{
error::Result,
in_raw,
view::{color::fore, RESET},
tio::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)?; // green foreground
write("Hello from raw mode!\n\r")?;
write(RESET)?; // reset style
cursor::set(0, h)?; // move cursor to the bottom
});
Ok(())
}
```
# Installation
From crates.io:
```bash
cargo add ruterm
```
From repository (more recent):
```bash
cargo add --git https://github.com/georgiyozhegov/ruterm.git
```
**Warning**: Currently, supports only Linux.
# References
- [Kilo Editor](https://github.com/antirez/kilo)
- [Raw Mode Tutorial](https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode.html)
- [ANSI Escape Codes](https://en.wikipedia.org/wiki/ANSI_escape_code)