Check whether Atomic hooks are installed in the plugin hooks file.
(config_dir: &Path)
| 559 | |
| 560 | /// Check whether Atomic hooks are installed in the plugin hooks file. |
| 561 | fn is_installed_in(config_dir: &Path) -> bool { |
| 562 | let hooks_path = Self::hooks_path(config_dir); |
| 563 | if !hooks_path.exists() { |
| 564 | return false; |
| 565 | } |
| 566 | |
| 567 | match Self::read_hooks_file(&hooks_path) { |
| 568 | Ok(groups) => groups |
| 569 | .get(ATOMIC_GROUP) |
| 570 | .map(group_has_atomic_commands) |
| 571 | .unwrap_or(false), |
| 572 | // Tolerate unparseable files (possible hand edits) by falling |
| 573 | // back to a raw content scan. |
| 574 | Err(_) => std::fs::read_to_string(&hooks_path) |
| 575 | .map(|content| content.contains(ATOMIC_HOOK_PREFIX)) |
| 576 | .unwrap_or(false), |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | // Import manifest management |
| 581 |
nothing calls this directly
no test coverage detected