(target: &str)
| 228 | } |
| 229 | |
| 230 | fn expand_target(target: &str) -> AgentResult<PathBuf> { |
| 231 | if target == "~" { |
| 232 | return dirs::home_dir().ok_or_else(|| AgentError::ConfigError { |
| 233 | operation: "resolve home".to_string(), |
| 234 | path: PathBuf::from(target), |
| 235 | reason: "could not determine home directory".to_string(), |
| 236 | }); |
| 237 | } |
| 238 | if let Some(rest) = target.strip_prefix("~/") { |
| 239 | let home = dirs::home_dir().ok_or_else(|| AgentError::ConfigError { |
| 240 | operation: "resolve home".to_string(), |
| 241 | path: PathBuf::from(target), |
| 242 | reason: "could not determine home directory".to_string(), |
| 243 | })?; |
| 244 | return Ok(home.join(rest)); |
| 245 | } |
| 246 | Ok(PathBuf::from(target)) |
| 247 | } |
| 248 | |
| 249 | fn read_json_object(path: &Path) -> AgentResult<Map<String, Value>> { |
| 250 | if !path.exists() { |
no outgoing calls
no test coverage detected