Give status information about new habit added.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-07-13 10:38:01 +02:00
parent b5f4c3bb13
commit baa2b8c612

View File

@ -77,12 +77,14 @@ impl HabitMgr
panic!("Error opening file {}:\n{}", self.habits_path.display(), e); panic!("Error opening file {}:\n{}", self.habits_path.display(), e);
}); });
let habit = Habit::new(name, bad, weight); let habit = Habit::new(name.clone(), bad, weight);
serde_json::to_writer(habits_file, &habit) serde_json::to_writer(habits_file, &habit)
.unwrap_or_else(|e| { .unwrap_or_else(|e| {
panic!("Error writing to file {}:\n{}", panic!("Error writing to file {}:\n{}",
self.habits_path.display(), e); self.habits_path.display(), e);
}) });
println!("New habit {} added.", &name);
} }
pub fn list(&mut self, all:bool, verbose:bool) pub fn list(&mut self, all:bool, verbose:bool)