romm_cli/tui/screens/setup_wizard/
event.rs1use crossterm::event::KeyEvent;
4
5#[derive(Debug)]
7pub enum SetupEvent {
8 Key(KeyEvent),
9 Paste(String),
10}
11
12#[derive(Debug)]
14pub enum SetupAction {
15 Key(KeyEvent),
16 Paste(String),
17}
18
19pub fn map_setup_event(event: SetupEvent) -> SetupAction {
20 match event {
21 SetupEvent::Key(key) => SetupAction::Key(key),
22 SetupEvent::Paste(text) => SetupAction::Paste(text),
23 }
24}
25
26impl super::SetupWizard {
27 pub fn update(&mut self, action: SetupAction) -> anyhow::Result<bool> {
29 match action {
30 SetupAction::Key(key) => self.handle_key(&key),
31 SetupAction::Paste(text) => {
32 self.handle_paste(&text);
33 Ok(false)
34 }
35 }
36 }
37}