summaryrefslogtreecommitdiffstats
path: root/cli/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r--cli/src/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 656107d..8f9cccf 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -53,6 +53,7 @@ impl Store {
})
}
+ //TODO check if hash matches
//TODO Result
//TODO overkill? maybe we can use subfolders later on
fn open_dir(dir: &Path) -> Option<Vec<Post>> {
@@ -69,13 +70,16 @@ impl Store {
Some(res)
}
- fn write(&self) {
+ fn write(&self) -> std::io::Result<()> {
for post in &self.posts {
let mut h = XxHash64::default();
post.hash(&mut h);
- let file = h.finish();
- println!("{}: {:?}", file, post);
+ let h = h.finish();
+ let mut path = self.root.clone();
+ path.push(format!("{}", h));
+ post.write(&path)?;
}
+ Ok(())
}
}