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

Function add_hook_to_matcher

atomic-agent/src/hooks/claude_code/settings.rs:165–184  ·  view source on GitHub ↗
(
    matchers: &mut Vec<ClaudeHookMatcher>,
    matcher_name: &str,
    command: &str,
)

Source from the content-addressed store, hash-verified

163}
164
165pub(crate) fn add_hook_to_matcher(
166 matchers: &mut Vec<ClaudeHookMatcher>,
167 matcher_name: &str,
168 command: &str,
169) {
170 let entry = ClaudeHookEntry {
171 hook_type: "command".to_string(),
172 command: command.to_string(),
173 };
174
175 if let Some(matcher) = matchers.iter_mut().find(|m| m.matcher == matcher_name) {
176 matcher.hooks.push(entry);
177 return;
178 }
179
180 matchers.push(ClaudeHookMatcher {
181 matcher: matcher_name.to_string(),
182 hooks: vec![entry],
183 });
184}
185
186pub(crate) fn has_any_atomic_hook(matchers: &[ClaudeHookMatcher]) -> bool {
187 matchers

Calls 2

iter_mutMethod · 0.80
pushMethod · 0.45