Skip to content

Commit

Permalink
fix(config): crash if no time management settings were provided in co…
Browse files Browse the repository at this point in the history
…nfig file
  • Loading branch information
louis-thevenet committed Nov 24, 2024
1 parent ada558e commit 1f2f0a7
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]
use std::{
collections::HashMap,
collections::{hash_map::Entry, HashMap},
env,
fs::{create_dir_all, File},
io::Write,
Expand Down Expand Up @@ -121,6 +121,30 @@ impl Config {
user_styles.entry(style_key.clone()).or_insert(*style);
}
}
if let Entry::Vacant(e) = cfg
.time_management_methods_settings
.entry(MethodsAvailable::Pomodoro)
{
e.insert(
default_config
.time_management_methods_settings
.get(&MethodsAvailable::Pomodoro)
.unwrap()
.clone(),
);
}
if let Entry::Vacant(e) = cfg
.time_management_methods_settings
.entry(MethodsAvailable::FlowTime)
{
e.insert(
default_config
.time_management_methods_settings
.get(&MethodsAvailable::FlowTime)
.unwrap()
.clone(),
);
}

if let Some(path) = &args.vault_path {
cfg.tasks_config.vault_path.clone_from(path);
Expand Down

0 comments on commit 1f2f0a7

Please sign in to comment.