Sort entries for a single command by date

This commit is contained in:
Joscha 2021-12-05 18:28:00 +01:00
parent 4c83df76d4
commit 6d090b428f

View file

@ -43,11 +43,16 @@ impl<'a> CommandState<'a> {
Ok(self) Ok(self)
} }
pub fn entries(self) -> Vec<Entry> { pub fn entries(mut self) -> Vec<Entry> {
self.dated let mut keys = self.dated.keys().copied().collect::<Vec<_>>();
.into_values() keys.sort();
.chain(self.undated.into_iter())
.collect() let mut entries = self.undated;
for key in keys {
entries.push(self.dated.remove(&key).unwrap());
}
entries
} }
// Helper functions // Helper functions