(
hooks: &mut Map<String, Value>,
event: &str,
command: &str,
status_message: Option<&str>,
timeout_sec: Option<u64>,
)
| 458 | } |
| 459 | |
| 460 | fn add_hook( |
| 461 | hooks: &mut Map<String, Value>, |
| 462 | event: &str, |
| 463 | command: &str, |
| 464 | status_message: Option<&str>, |
| 465 | timeout_sec: Option<u64>, |
| 466 | ) -> bool { |
| 467 | let groups = hooks |
| 468 | .entry(event.to_string()) |
| 469 | .or_insert_with(|| Value::Array(Vec::new())); |
| 470 | let Some(groups) = groups.as_array_mut() else { |
| 471 | *groups = Value::Array(Vec::new()); |
| 472 | let Some(groups) = hooks.get_mut(event).and_then(Value::as_array_mut) else { |
| 473 | return false; |
| 474 | }; |
| 475 | return add_hook_to_groups(groups, command, status_message, timeout_sec); |
| 476 | }; |
| 477 | add_hook_to_groups(groups, command, status_message, timeout_sec) |
| 478 | } |
| 479 | |
| 480 | fn add_hook_to_groups( |
| 481 | groups: &mut Vec<Value>, |
no test coverage detected