From baa2b8c612a1a02698d21cc0c75d8e2f24c23bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Wed, 13 Jul 2022 10:38:01 +0200 Subject: [PATCH] Give status information about new habit added. --- src/habitmgr.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/habitmgr.rs b/src/habitmgr.rs index 56e0b79..e0266ea 100644 --- a/src/habitmgr.rs +++ b/src/habitmgr.rs @@ -77,12 +77,14 @@ impl HabitMgr 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) .unwrap_or_else(|e| { panic!("Error writing to file {}:\n{}", self.habits_path.display(), e); - }) + }); + + println!("New habit {} added.", &name); } pub fn list(&mut self, all:bool, verbose:bool)