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