summaryrefslogtreecommitdiffstats
path: root/cli/src/main.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-07-29 02:14:55 +0200
committerGustav Sörnäs <gustav@sornas.net>2021-07-29 02:14:55 +0200
commit5216a6a67d1bde60f4c872b8d8d966efe02dd4e4 (patch)
tree521fb83571d25263dc4fae3d512abf17e46c6562 /cli/src/main.rs
parent29d3813d14f32be9067a7a6d3040824637d8987e (diff)
downloadmoney-5216a6a67d1bde60f4c872b8d8d966efe02dd4e4.tar.gz
flatter store and actually insert
Posts aren't mutable. Removals will be handled later.
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r--cli/src/main.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 606d3c1..a760401 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -35,6 +35,8 @@ struct Mn {
// mn insert expense --account Kortkonto --category a --category b
fn main() {
+ let mut store = model::Store::open(PathBuf::from("store")).unwrap();
+ println!("{:?}", store);
match Mn::from_args().command {
Command::Insert {
kind,
@@ -43,19 +45,17 @@ fn main() {
amount,
description,
} => {
- let post = model::Post::new(model::Transaction {
+ let transaction = model::Transaction {
kind,
to: account,
from: "Default".to_string(),
category,
amount,
description
- });
- println!("{:?}", post);
+ };
+ println!("{:?}", transaction);
+ store.push(transaction);
+ store.write().unwrap();
}
}
- // post.write(&"test").unwrap();
- // let store = model::Store::open(PathBuf::from("store")).unwrap();
- // println!("{:#?}", store);
- // store.write().unwrap();
}