1use {
2 process_terminal::{
3 KeyCode, MessageSettings, ProcessSettings, ScrollSettings, add_process,
4 block_search_message, end_terminal, tprintln, utils::create_printing_process,
5 },
6 std::{thread::sleep, time::Duration},
7};
8
9fn main() {
10 let process_foo = create_printing_process(["hello", "world", "foo", "bar"], 1.0, 30);
12
13 add_process(
16 "Foo",
17 process_foo,
18 ProcessSettings::new_with_scroll(
19 MessageSettings::Output,
21 ScrollSettings::enable(KeyCode::Left, KeyCode::Right),
24 ),
25 )
26 .unwrap();
27
28 sleep(Duration::from_secs(2));
29
30 let process_bar = create_printing_process(
32 ["hello", "Err: this is an error! >&2", "foo", "bar"],
33 0.1,
34 8,
35 );
36
37 add_process(
38 "Bar",
39 process_bar,
40 ProcessSettings::new(MessageSettings::All),
42 )
43 .unwrap();
44
45 sleep(Duration::from_secs(2));
46
47 tprintln!("searching_message");
50 let msg = block_search_message("Foo", "llo").unwrap();
52 tprintln!("msg found: {}", msg);
53 assert_eq!(msg, "hello");
54
55 tprintln!("searching_message");
56 let msg = block_search_message("Bar", "ar").unwrap();
57 tprintln!("msg found: {}", msg);
58 assert_eq!(msg, "bar");
59
60 sleep(Duration::from_secs(20));
61
62 end_terminal();
64}
65