MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / add_hook

Function add_hook

atomic-agent/src/hooks/codex.rs:460–478  ·  view source on GitHub ↗
(
    hooks: &mut Map<String, Value>,
    event: &str,
    command: &str,
    status_message: Option<&str>,
    timeout_sec: Option<u64>,
)

Source from the content-addressed store, hash-verified

458}
459
460fn 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
480fn add_hook_to_groups(
481 groups: &mut Vec<Value>,

Callers 1

install_hooks_atFunction · 0.85

Calls 2

add_hook_to_groupsFunction · 0.85
get_mutMethod · 0.80

Tested by

no test coverage detected