1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
mod app;
mod app_action;
mod app_event;
mod component;
mod components;
mod keys;
mod tui;
use eyre::Result;
use app_action::AppAction;
use keys::key_commands::KeyCommand;
fn main() -> Result<()> {
tui::install_hooks()?;
let mut app = app::App::new(std::time::Duration::from_millis(10))?;
let mut key_commands = vec![
// Status bar
KeyCommand {
key_code: "o".to_string(),
description: "Open new link".to_string(),
action: AppAction::OpenUrl,
},
// Navigation
KeyCommand {
key_code: "g".to_string(),
description: "Scroll to top".to_string(),
action: AppAction::ScrollTop,
},
KeyCommand {
key_code: "G".to_string(),
description: "Scroll to bottom".to_string(),
action: AppAction::ScrollBottom,
},
KeyCommand {
key_code: "k".to_string(),
description: "Scroll up one line".to_string(),
action: AppAction::ScrollUp,
},
KeyCommand {
key_code: "j".to_string(),
description: "Scroll down one line".to_string(),
action: AppAction::ScrollDown,
},
KeyCommand {
key_code: "q".to_string(),
description: "Quit molehole".to_string(),
action: AppAction::Quit,
},
KeyCommand {
key_code: "?".to_string(),
description: "Toggle help menu".to_string(),
action: AppAction::ShowHelpMenu,
},
];
app.key_commands.append(&mut key_commands);
app.run()
}
|