diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index d3080ab..4e2a5f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,18 +17,27 @@ struct Opt { /// List today’s events as plain text #[clap(long = "list-today")] list_today: bool, + + /// Start between <timestamp..timestamp> events as plain text + #[clap(long = "start-between")] + start_between: Option<String>, } fn main() -> Result<()> { let Opt { db_path, list_today, + start_between } = Opt::parse(); let conn = db::init(&db_path)?; if list_today { print!("{}", cli::today(&conn)?); } else { - gui::run(conn); - } + match start_between.and_then(cli::parse_timestamp_range) { + Some((from, to)) => print!("{}", cli::start_between(&conn, from, to)?), + None => gui::run(conn) + } + }; Ok(()) } + |