From fbe6787acb3c844339e34c3bf4509c36281693e6 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 17 Nov 2024 13:00:35 +0100 Subject: Add --start-between CLI option --- src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/main.rs') 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 events as plain text + #[clap(long = "start-between")] + start_between: Option, } 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(()) } + -- cgit v1.2.3