2018-01-28 04:26:08 +11:00
|
|
|
//! This bin folder can be used to try the examples out located in the examples directory.
|
|
|
|
//!
|
|
|
|
//! All you need to do is:
|
|
|
|
//!
|
|
|
|
//! - Download the crossterm source code.
|
|
|
|
//! - Add this in the Cargo.toml file:
|
|
|
|
//! ``` [[bin]]
|
|
|
|
//! name = "example_bin"
|
|
|
|
//! path = "./examples/bin.rs"
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! - Run program with: `cargo run`
|
|
|
|
|
2018-01-04 00:43:54 +11:00
|
|
|
extern crate crossterm;
|
2018-01-10 06:36:48 +11:00
|
|
|
|
2018-06-14 05:02:09 +10:00
|
|
|
mod terminal;
|
2018-06-17 04:10:51 +10:00
|
|
|
mod cursor;
|
|
|
|
mod color;
|
2018-06-14 05:02:09 +10:00
|
|
|
|
|
|
|
use terminal::alternate_screen;
|
|
|
|
use terminal::raw_mode;
|
2018-06-17 04:10:51 +10:00
|
|
|
use terminal::terminal as term;
|
2018-06-14 05:02:09 +10:00
|
|
|
|
2018-06-17 04:10:51 +10:00
|
|
|
use self::crossterm::Context;
|
|
|
|
use self::crossterm::terminal::ClearType;
|
|
|
|
use crossterm::raw;
|
|
|
|
use crossterm::screen;
|
|
|
|
use crossterm::raw::IntoRawMode;
|
|
|
|
use std::io::Write;
|
|
|
|
use std::{time, thread};
|
2018-06-14 05:02:09 +10:00
|
|
|
|
2018-01-18 09:06:45 +11:00
|
|
|
fn main() {
|
2018-06-24 03:48:22 +10:00
|
|
|
//// alternate_screen::switch_between_main_and_alternate_screen();
|
2018-06-17 04:10:51 +10:00
|
|
|
let context = Context::new();
|
2018-06-24 03:48:22 +10:00
|
|
|
// let mut scre = screen::AlternateScreen::from(context.clone());
|
|
|
|
// write!(scre, "asdf");
|
|
|
|
// scre.flush();
|
|
|
|
// thread::sleep(time::Duration::from_secs(3));
|
|
|
|
|
|
|
|
use crossterm::terminal::terminal;
|
|
|
|
|
|
|
|
let curs = terminal(context.clone());
|
|
|
|
curs.set_title(String::from("Test"));
|
2018-03-04 01:40:51 +11:00
|
|
|
}
|