process_terminal/
settings.rs1use crossterm::event::KeyCode;
2
3#[derive(Clone, PartialEq)]
4pub struct ProcessSettings {
5 pub messages: MessageSettings,
6 pub scroll: ScrollSettings,
7 pub clear_regex: bool,
8}
9
10impl ProcessSettings {
11 pub fn new(messages: MessageSettings) -> Self {
12 Self {
13 messages,
14 scroll: ScrollSettings::Disable,
15 clear_regex: true,
16 }
17 }
18
19 pub fn new_with_scroll(messages: MessageSettings, scroll: ScrollSettings) -> Self {
20 Self {
21 messages,
22 scroll,
23 clear_regex: true,
24 }
25 }
26
27 pub fn disable_clear_regex(self) -> Self {
28 Self {
29 clear_regex: false,
30 ..self
31 }
32 }
33}
34
35#[derive(Clone, PartialEq)]
36pub enum MessageSettings {
37 None,
38 Output,
39 Error,
40 All,
41}
42
43#[derive(Clone, PartialEq)]
44pub enum ScrollSettings {
45 Disable,
46 Enable { up: KeyCode, down: KeyCode },
47}
48
49impl ScrollSettings {
50 pub fn enable(up: KeyCode, down: KeyCode) -> Self {
51 ScrollSettings::Enable { up, down }
52 }
53}