From e63f92bc607236b11fc4f1a3bdb22da22a8e00f1 Mon Sep 17 00:00:00 2001 From: RanXom Date: Sat, 13 Jun 2026 00:14:20 +0530 Subject: save current status to status.json --- src/pomo/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/pomo') 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> { 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(()) } -- cgit v1.2.3