(
hooks: &mut Map<String, Value>,
event: &str,
command: &str,
status_message: Option<&str>,
)
| 410 | } |
| 411 | |
| 412 | fn add_hook( |
| 413 | hooks: &mut Map<String, Value>, |
| 414 | event: &str, |
| 415 | command: &str, |
| 416 | status_message: Option<&str>, |
| 417 | ) -> bool { |
| 418 | let groups = hooks |
| 419 | .entry(event.to_string()) |
| 420 | .or_insert_with(|| Value::Array(Vec::new())); |
| 421 | let Some(groups) = groups.as_array_mut() else { |
| 422 | *groups = Value::Array(Vec::new()); |
| 423 | let Some(groups) = hooks.get_mut(event).and_then(Value::as_array_mut) else { |
| 424 | return false; |
| 425 | }; |
| 426 | return add_hook_to_groups(groups, command, status_message); |
| 427 | }; |
| 428 | add_hook_to_groups(groups, command, status_message) |
| 429 | } |
| 430 | |
| 431 | fn add_hook_to_groups( |
| 432 | groups: &mut Vec<Value>, |
no test coverage detected