(
hooks: &mut Map<String, Value>,
event: &str,
command: &str,
status_message: Option<&str>,
timeout_sec: Option<u64>,
)
| 472 | } |
| 473 | |
| 474 | fn add_hook( |
| 475 | hooks: &mut Map<String, Value>, |
| 476 | event: &str, |
| 477 | command: &str, |
| 478 | status_message: Option<&str>, |
| 479 | timeout_sec: Option<u64>, |
| 480 | ) -> bool { |
| 481 | let groups = hooks |
| 482 | .entry(event.to_string()) |
| 483 | .or_insert_with(|| Value::Array(Vec::new())); |
| 484 | let Some(groups) = groups.as_array_mut() else { |
| 485 | *groups = Value::Array(Vec::new()); |
| 486 | let Some(groups) = hooks.get_mut(event).and_then(Value::as_array_mut) else { |
| 487 | return false; |
| 488 | }; |
| 489 | return add_hook_to_groups(groups, command, status_message, timeout_sec); |
| 490 | }; |
| 491 | add_hook_to_groups(groups, command, status_message, timeout_sec) |
| 492 | } |
| 493 | |
| 494 | fn add_hook_to_groups( |
| 495 | groups: &mut Vec<Value>, |
no test coverage detected