summaryrefslogtreecommitdiffstats
path: root/cli/src/main.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-07-29 16:41:29 +0200
committerGustav Sörnäs <gustav@sornas.net>2021-07-29 16:41:29 +0200
commit0e2f1896ef8a2e4e85b4bf5e4d97f4bc8a032676 (patch)
tree9d80a2ff1361cb1bcfecd382312308386c6a5dbb /cli/src/main.rs
parent750ac56977cd08d850cf902c8c8070512ecf484f (diff)
downloadmoney-0e2f1896ef8a2e4e85b4bf5e4d97f4bc8a032676.tar.gz
sort store by date
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r--cli/src/main.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 55279b1..48bbb1d 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -71,7 +71,7 @@ struct Mn {
fn main() {
let mut store = Store::open(PathBuf::from("store")).unwrap();
- let search = Search::new(store.transactions().iter().collect());
+ let search = Search::new(store.transactions());
let search = search.subtract(Constraint::Category("a".to_string()));
let args = Mn::from_args();
@@ -108,7 +108,9 @@ fn main() {
println!("{}", store.categories().join("\n"));
}
Command::Show => {
- println!("{}", Table::new(store.transactions()).with(Style::psql()));
+ let mut transactions = store.transactions();
+ transactions.sort_by(|t1, t2| t1.date.cmp(&t2.date));
+ println!("{}", Table::new(transactions).with(Style::psql()));
}
}
}