pub struct HookRegistry { /* private fields */ }Expand description
Registry of all configured hooks.
Implementations§
Source§impl HookRegistry
impl HookRegistry
pub fn new() -> Self
pub fn add(&mut self, event: HookEvent, command: String)
pub fn is_empty(&self) -> bool
Sourcepub fn fire(&self, event: HookEvent, session: &ClaudeSession)
pub fn fire(&self, event: HookEvent, session: &ClaudeSession)
Fire all hooks for an event with session context.
Sourcepub fn fire_with_status(
&self,
event: HookEvent,
session: &ClaudeSession,
old_status: &str,
new_status: &str,
)
pub fn fire_with_status( &self, event: HookEvent, session: &ClaudeSession, old_status: &str, new_status: &str, )
Fire hooks with just a status string (for events without a specific session, like StatusChange).
Sourcepub fn fire_env(&self, event: HookEvent, vars: &[(&str, &str)])
pub fn fire_env(&self, event: HookEvent, vars: &[(&str, &str)])
Fire hooks for an event that has no session behind it.
fire and fire_with_status both expand a ClaudeSession into the
command template. Some events are not about a session at all — a
third-party query queued for review (#446) belongs to a grant, not a
PID — so this passes context as environment variables instead and
expands no template placeholders.
Spawned and dropped, never waited on, exactly as fire does: the
caller here is a query serve connection thread answering a request,
and a slow hook must not hold the response open.
Sourcepub fn print_list(&self)
pub fn print_list(&self)
List all configured hooks (for claudectl --hooks).
Trait Implementations§
Source§impl Clone for HookRegistry
impl Clone for HookRegistry
Source§impl Debug for HookRegistry
impl Debug for HookRegistry
Auto Trait Implementations§
impl Freeze for HookRegistry
impl RefUnwindSafe for HookRegistry
impl Send for HookRegistry
impl Sync for HookRegistry
impl Unpin for HookRegistry
impl UnsafeUnpin for HookRegistry
impl UnwindSafe for HookRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more