add -c/--clock

main
Bel LaPointe 2023-12-11 08:25:01 -07:00
parent 7463ca2069
commit e6ceef2ead
1 changed files with 11 additions and 0 deletions

View File

@ -22,15 +22,26 @@ struct Flags {
#[arg(short = 't', long = "tag")]
tag: Option<String>,
#[arg(short = 'c', long = "clock")]
clock: bool,
}
fn main() {
let flags = Flags::parse();
clock(&flags.f, &flags.clock).unwrap();
add(&flags.f, &flags.add, &flags.tag).unwrap();
log(&flags.f, &flags.log, &flags.since).unwrap();
}
fn clock(f: &String, clock: &bool) -> Result<(), String> {
match clock {
true => add(&f, &Some("".to_string()), &None),
false => Ok(()),
}
}
fn add(f: &String, x: &Option<String>, tag: &Option<String>) -> Result<(), String> {
match x {
Some(x) => {