(target: &str)
| 190 | } |
| 191 | |
| 192 | fn expand_target(target: &str) -> AgentResult<PathBuf> { |
| 193 | if target == "~" { |
| 194 | return dirs::home_dir().ok_or_else(|| AgentError::ConfigError { |
| 195 | operation: "resolve home".to_string(), |
| 196 | path: PathBuf::from(target), |
| 197 | reason: "could not determine home directory".to_string(), |
| 198 | }); |
| 199 | } |
| 200 | if let Some(rest) = target.strip_prefix("~/") { |
| 201 | let home = dirs::home_dir().ok_or_else(|| AgentError::ConfigError { |
| 202 | operation: "resolve home".to_string(), |
| 203 | path: PathBuf::from(target), |
| 204 | reason: "could not determine home directory".to_string(), |
| 205 | })?; |
| 206 | return Ok(home.join(rest)); |
| 207 | } |
| 208 | Ok(PathBuf::from(target)) |
| 209 | } |
| 210 | |
| 211 | fn read_json_object(path: &Path) -> AgentResult<Map<String, Value>> { |
| 212 | if !path.exists() { |
no outgoing calls
no test coverage detected