use chrono::{Duration, Local};
use clap::Parser;
#[derive(Parser)]
#[command(about, version)]
struct Opt {
count: i64,
#[arg(long)]
past: bool,
}
fn main() {
let today = Local::now().date_naive();
let opt = Opt::parse();
let date = if opt.past {
today.checked_sub_signed(Duration::weeks(opt.count))
} else {
today.checked_add_signed(Duration::weeks(opt.count))
};
match date {
Some(date) => println!("{date}"),
None => eprintln!("Date not representable... overflow!"),
};
}