Commit 8a172fdb authored by Ticki's avatar Ticki

Add README

parent bf7ca5c1
target
Cargo.lock
[package]
name = "libterm"
version = "0.1.0"
authors = ["Ticki <Ticki@users.noreply.github.com>"]
[dependencies]
libterm
=======
A Rust Termios wrapper, providing various useful abstractions for dealing with terminals.
Usage
-----
See `examples/`.
License
-------
MIT.
extern crate libterm;
use libterm::{TermControl, raw_mode};
use std::io::{Read, Write, stdout, stdin};
fn main() {
let raw = raw_mode();
let mut stdout = stdout();
let mut stdin = stdin();
stdout.goto(5, 5);
stdout.clear();
stdout.write(b"yo, 'q' will exit.");
stdout.flush();
let mut bytes = stdin.bytes();
loop {
let b = bytes.next().unwrap().unwrap();
match b {
b'q' => return,
b'c' => stdout.clear(),
a => stdout.write(&[a]),
};
stdout.flush();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment