Format list.
This commit is contained in:
parent
d7f38f26b9
commit
a52071258a
@ -108,12 +108,25 @@ impl HabitMgr
|
|||||||
println!("Removed habit {}", old_habit.get_name());
|
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();
|
self.import_habits();
|
||||||
|
if self.habits.is_empty()
|
||||||
|
{
|
||||||
|
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()
|
for (i, habit) in self.habits.iter().enumerate()
|
||||||
{
|
{
|
||||||
println!("{}\t{}", i, habit.get_name());
|
println!(" {0: <3} | {1: <5} | {2: <6} | {3}",
|
||||||
|
i,
|
||||||
|
habit.get_bad(),
|
||||||
|
habit.get_weight(),
|
||||||
|
habit.get_name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user