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

Function add_hook

atomic-agent/src/hooks/codex.rs:474–492  ·  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

472}
473
474fn 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
494fn add_hook_to_groups(
495 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