diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 956e930..1f5a294 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +mod cli; mod db; mod gui; mod model; @@ -8,13 +9,25 @@ use structopt::StructOpt; #[derive(StructOpt)] #[structopt()] struct Opt { - #[structopt(long, default_value = "database.db")] - database: String, + /// Path of SQLite database in which to store events + #[structopt(long = "database", default_value = "database.db")] + db_path: String, + + /// List today’s events as plain text + #[structopt(long = "list-today")] + list_today: bool, } fn main() -> Result<()> { - let db_path = Opt::from_args().database; + let Opt { + db_path, + list_today, + } = Opt::from_args(); let conn = db::init(&db_path)?; - gui::run(conn); + if list_today { + print!("{}", cli::today(&conn)?); + } else { + gui::run(conn); + } Ok(()) } |