Add README

This commit is contained in:
Ticki 2016-03-06 14:55:01 +01:00
parent bf7ca5c143
commit 8a172fdbda
4 changed files with 50 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
target
Cargo.lock

6
Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[package]
name = "libterm"
version = "0.1.0"
authors = ["Ticki <Ticki@users.noreply.github.com>"]
[dependencies]

14
README.md Normal file
View File

@ -0,0 +1,14 @@
libterm
=======
A Rust Termios wrapper, providing various useful abstractions for dealing with terminals.
Usage
-----
See `examples/`.
License
-------
MIT.

28
examples/simple.rs Normal file
View File

@ -0,0 +1,28 @@
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();
}
}