mod db; mod deck; mod gui; mod model; mod space_repetition; mod util; use anyhow::Result; use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt)] #[structopt()] struct Opt { #[structopt(long, default_value = "deck.deck")] deck: String, } fn main() -> Result<()> { let deck = Opt::from_args().deck; let conn = db::db::init(db_path(&deck))?; let entries = deck::read(&deck)?; db::db::synchronize(&conn, entries)?; let deck_name = deck::pp_from_path(&deck).unwrap_or("Deck".to_string()); gui::gui::start(&conn, &deck_name) } fn db_path(deck_path: &String) -> String { let mut path = PathBuf::from(deck_path); path.set_extension("db"); path.to_string_lossy().to_string() }