feat: add -C / --create-config directory
This commit is contained in:
parent
0346154f7b
commit
0e03745f0b
23
src/main.rs
23
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<Alert> {
|
||||
let alert_dir = ProjectDirs::from("moe", "paoda", "domasi")
|
||||
.unwrap()
|
||||
|
|
Loading…
Reference in New Issue