aboutsummaryrefslogtreecommitdiff
path: root/src/pomo/mod.rs
diff options
context:
space:
mode:
authorRanXom <saiyedshizain@gmail.com>2026-06-13 00:14:20 +0530
committerRanXom <saiyedshizain@gmail.com>2026-06-13 00:14:20 +0530
commite63f92bc607236b11fc4f1a3bdb22da22a8e00f1 (patch)
treed7eae70b3741a395ceaadc0a8624bbfe28fb5dcc /src/pomo/mod.rs
parent1dd93bbb49e305a3f3081ded013b46f6be43ba94 (diff)
downloadpomoru-e63f92bc607236b11fc4f1a3bdb22da22a8e00f1.tar.xz
pomoru-e63f92bc607236b11fc4f1a3bdb22da22a8e00f1.zip
save current status to status.json
Diffstat (limited to 'src/pomo/mod.rs')
-rw-r--r--src/pomo/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pomo/mod.rs b/src/pomo/mod.rs
index c6bd35c..ece7e8e 100644
--- a/src/pomo/mod.rs
+++ b/src/pomo/mod.rs
@@ -35,12 +35,18 @@ impl Pomo {
}
}
- pub fn export_status(&self) -> std::io::Result<()> {
+ pub fn export_status(&self) -> Result<(), Box<dyn std::error::Error>> {
let status = self.current_status();
let json = serde_json::to_string(&status)?;
- // TODO: write to ~/.cache/pomoru/status.json
+ let cache_dir = ProjectDirs::from("", "", "pomoru")
+ .ok_or("Could not find cache directory")?
+ .cache_dir()
+ .to_path_buf();
+
+ fs::create_dir_all(&cache_dir)?;
+ fs::write(cache_dir.join("status.json"), json)?;
Ok(())
}