diff --git a/src/habitmgr.rs b/src/habitmgr.rs index 3833d33..989ea34 100644 --- a/src/habitmgr.rs +++ b/src/habitmgr.rs @@ -108,12 +108,25 @@ impl HabitMgr println!("Removed habit {}", old_habit.get_name()); } - pub fn list(&mut self, all:bool, verbose:bool) + pub fn list(&mut self, _all:bool, _verbose:bool) { self.import_habits(); - for (i, habit) in self.habits.iter().enumerate() + if self.habits.is_empty() { - println!("{}\t{}", i, habit.get_name()); + println!("There are no habits. Add one!"); + } + else + { + println!(" {0: <3} | {1: <5} | {2: <6} | {3}", + "id", "bad", "weight", "name"); + for (i, habit) in self.habits.iter().enumerate() + { + println!(" {0: <3} | {1: <5} | {2: <6} | {3}", + i, + habit.get_bad(), + habit.get_weight(), + habit.get_name()); + } } } }