Skip to main content

register_command

Method
This is a method of the HookRegistry class in the registry module.
Register a shell command as a hook.

Signature

def register_command(event: HookEvent, command: str, matcher: Optional[str], name: Optional[str], description: Optional[str], sequential: bool, timeout: float, env: Optional[Dict[str, str]], shell: bool) -> str

Parameters

event
HookEvent
required
The event to hook
command
str
required
The shell command to execute
matcher
Optional
Optional regex pattern to match targets
name
Optional
Optional name for the hook
description
Optional
Optional description
sequential
bool
default:"False"
Whether to run sequentially
timeout
float
default:"60.0"
Timeout in seconds
env
Optional
Additional environment variables
shell
bool
default:"True"
Whether to run in shell mode

Returns

Returns
str
The hook ID