1 | 1 | | mod event_handler; |
2 | 2 | | mod events; |
3 | | - | mod ui; |
4 | 3 | | mod formatter; |
| 4 | + | mod ui; |
5 | 5 | | |
6 | | - | use crate::database; |
7 | | - | use crate::output; |
8 | | - | use crate::params::Params; |
9 | | - | use crate::scanner; |
| 6 | + | use std::{io, thread, time::Duration}; |
| 7 | + | |
10 | 8 | | use anyhow::{anyhow, Result}; |
11 | 9 | | use crossterm::{event, execute, terminal}; |
12 | 10 | | use event_handler::EventHandler; |
13 | | - | use std::io; |
14 | | - | use std::thread; |
15 | | - | use std::time::Duration; |
16 | 11 | | use tui::{ |
17 | 12 | | backend::CrosstermBackend, |
18 | 13 | | widgets::{Block, Borders, Widget}, |
| skipped 1 lines |
20 | 15 | | }; |
21 | 16 | | use ui::Ui; |
22 | 17 | | |
| 18 | + | use crate::database; |
| 19 | + | use crate::output; |
| 20 | + | use crate::params::Params; |
| 21 | + | use crate::scanner; |
| 22 | + | |
23 | 23 | | pub struct App; |
24 | 24 | | |
25 | 25 | | impl App { |
26 | 26 | | pub fn init(app_args: &Params) -> Result<()> { |
27 | 27 | | // let mut term = Self::init_terminal()?; |
28 | 28 | | |
29 | | - | let connection = database::get_connection(&app_args)?; |
30 | | - | let duplicates = scanner::duplicates(&app_args, &connection)?; |
| 29 | + | let connection = database::get_connection(app_args)?; |
| 30 | + | let duplicates = scanner::duplicates(app_args, &connection)?; |
31 | 31 | | |
32 | 32 | | // Self::init_render_loop(&mut term)?; |
33 | 33 | | // Self::cleanup(&mut term)?; |
34 | 34 | | |
35 | | - | output::print(duplicates, &app_args); /* TODO: APP TUI INIT FUNCTION */ |
| 35 | + | output::print(duplicates, app_args); /* TODO: APP TUI INIT FUNCTION */ |
36 | 36 | | Ok(()) |
37 | 37 | | } |
38 | 38 | | |
| skipped 17 lines |
56 | 56 | | } |
57 | 57 | | |
58 | 58 | | fn init_render_loop(term: &mut Terminal<CrosstermBackend<io::Stdout>>) -> Result<()> { |
| 59 | + | // this could be simplified with a `while Self::render_cycle(term).is_ok() {}` in the current state, but maybe |
| 60 | + | // it's good to keep it to handle errors in the future |
59 | 61 | | loop { |
60 | 62 | | match Self::render_cycle(term) { |
61 | 63 | | Ok(_) => continue, |
| skipped 20 lines |