1extern crate interactor;
2use interactor::*;
3use std::io::Write;
4
5#[allow(unused_must_use)]
6fn main() {
7 println!("Interactor demo. Type something:");
8
9 let read_result = read_from_tty(|buf, b, tty| {
10 tty.write(&format!("({:?} | {})\n", buf, b).into_bytes());
11 }, false, false).unwrap();
12 println!("Read: {}", String::from_utf8(read_result).unwrap());
13
14 let chosen_ext = pick_from_list(default_menu_cmd().as_mut(), &["first", "second"], "").unwrap();
15 println!("Congratulations, you chose '{}'!!", chosen_ext);
16
17 let chosen_file = pick_file(|| default_menu_cmd(), std::env::current_dir().unwrap()).unwrap();
18 println!("Congratulations, you chose '{}'!!", chosen_file.display());
19
20 let chosen_int = pick_from_list(None, &["first", "second"], "Selection: ").unwrap();
21 println!("Congratulations, you chose '{}'!!", chosen_int);
22}