(hooks: &serde_json::Value, event: &str, command: &str)
| 1485 | } |
| 1486 | |
| 1487 | fn codex_hook_present(hooks: &serde_json::Value, event: &str, command: &str) -> bool { |
| 1488 | hooks["hooks"][event].as_array().is_some_and(|groups| { |
| 1489 | groups.iter().any(|group| { |
| 1490 | group["hooks"].as_array().is_some_and(|handlers| { |
| 1491 | handlers.iter().any(|h| { |
| 1492 | h["command"] |
| 1493 | .as_str() |
| 1494 | .is_some_and(|value| value.contains(command)) |
| 1495 | }) |
| 1496 | }) |
| 1497 | }) |
| 1498 | }) |
| 1499 | } |
| 1500 | #[cfg(test)] |
| 1501 | #[allow(clippy::unwrap_used, clippy::expect_used)] |
| 1502 | mod tests; |
no test coverage detected