aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJoris2024-11-17 13:00:35 +0100
committerJoris2024-11-17 13:00:35 +0100
commitfbe6787acb3c844339e34c3bf4509c36281693e6 (patch)
tree20f6d2147b18324ce2b6ba9b40e7757ec1cf9c28 /src/main.rs
parent0fad55124684989ec9fd9a742b5731359d0238ce (diff)
Add --start-between CLI option
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
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(())
}
+