diff --git a/src/main.rs b/src/main.rs index 8149248..46b6764 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,18 @@ use std::fs; use std::path::PathBuf; fn main() { + let mut args = std::env::args_os(); + + if let Some(os_string) = args.nth(1) { + match os_string.to_str() { + Some("-C") | Some("--create-config") => { + let _ = create_alert_directory(); + } + None => {} + arg => println!("Unsupported Argument: {}", arg.unwrap()), + } + } + let mut domasi: Pomodoro = Default::default(); match get_alert() { @@ -13,6 +25,17 @@ fn main() { } } +fn create_alert_directory() -> std::io::Result<()> { + let alert_dir = ProjectDirs::from("moe", "paoda", "domasi") + .unwrap() + .data_dir() + .to_path_buf() + .join("alert"); + + fs::create_dir_all(alert_dir)?; + Ok(()) +} + fn get_alert() -> Option { let alert_dir = ProjectDirs::from("moe", "paoda", "domasi") .unwrap()