An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          



Ruterm


Tiny (~400 loc) library for working with the terminal



[![docs.rs](https://img.shields.io/docsrs/ruterm)](https://docs.rs/ruterm/latest/ruterm/)
[![crates.io](https://img.shields.io/crates/d/ruterm)](https://crates.io/crates/ruterm)
![GitHub License](https://img.shields.io/github/license/georgiyozhegov/terminal)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/georgiyozhegov/terminal)

# 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)