git-time-cheater/src/main.rs

27 lines
631 B
Rust
Raw Normal View History

mod args;
mod err;
mod time;
use chrono::prelude::*;
use chrono_tz::Tz;
use clap::Parser;
fn main() {
let cli = args::Cli::parse();
println!("{:#?}", cli);
let start_time = match cli.timezone {
Some(tz) => tz.from_local_datetime(&cli.start_time).unwrap(),
None => get_local_timezone()
.expect("Could not get local timezone")
.from_local_datetime(&cli.start_time)
.unwrap(),
};
}
fn get_local_timezone() -> Result<Tz, String> {
match iana_time_zone::get_timezone() {
Ok(tz_string) => tz_string.parse(),
Err(e) => Err(e.to_string()),
}
}