diff options
-rw-r--r-- | src/deck.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/deck.rs b/src/deck.rs index 384ce19..0fe8a7b 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -23,8 +23,8 @@ impl std::error::Error for ParseError { } -pub fn read() -> Result<Vec<Entry>> { - let file = File::open("deck")?; +pub fn read(deck: String) -> Result<Vec<Entry>> { + let file = File::open(deck)?; let reader = BufReader::new(file); let mut entries: Vec<Entry> = Vec::new(); diff --git a/src/main.rs b/src/main.rs index ef47c73..6ef241b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,14 +11,17 @@ use structopt::StructOpt; #[derive(StructOpt)] #[structopt()] struct Opt { - #[structopt(short, long, default_value = "database.db")] + #[structopt(long, default_value = "database.db")] database: String, + + #[structopt(long, default_value = "deck.deck")] + deck: String, } fn main() -> Result<()> { let opt = Opt::from_args(); let conn = db::db::init(opt.database)?; - let entries = deck::read()?; + let entries = deck::read(opt.deck)?; db::db::add_missing_deck_entries(&conn, entries)?; gui::gui::start(&conn) } |