use jira_tasks::app::App;
use jira_tasks::{event_handler, terminal};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let mut term = terminal::setup()?;
    std::fs::create_dir_all("./tmp/")?;
    let mut app = App::new("./tmp/tasks.db")?;
    let res = event_handler::run(&mut term, &mut app);

    terminal::restore(&mut term)?;

    if let Err(err) = res {
        eprintln!("Error: {err:?}");
    }

    Ok(())
}
