Persist the receipt under `~/.atomic/integrations/ /`.
(&self)
| 119 | |
| 120 | /// Persist the receipt under `~/.atomic/integrations/<agent>/`. |
| 121 | pub fn save(&self) -> AgentResult<PathBuf> { |
| 122 | let path = receipt_path(&self.agent)?; |
| 123 | if let Some(parent) = path.parent() { |
| 124 | std::fs::create_dir_all(parent)?; |
| 125 | } |
| 126 | let json = serde_json::to_string_pretty(self)?; |
| 127 | std::fs::write(&path, format!("{json}\n"))?; |
| 128 | Ok(path) |
| 129 | } |
| 130 | |
| 131 | /// Load an agent's receipt, if one exists. |
| 132 | pub fn load(agent: &str) -> AgentResult<Option<Self>> { |
no test coverage detected