Documentation
¶
Overview ¶
Package hooks provides a middleware system for CM operations.
Index ¶
- type ErrorHook
- type Hook
- type HookContext
- type HookManager
- func (hm *HookManager) ExecuteErrorHooks(operation string, ctx *HookContext) error
- func (hm *HookManager) ExecutePostHooks(operation string, ctx *HookContext) error
- func (hm *HookManager) ExecutePreHooks(operation string, ctx *HookContext) error
- func (hm *HookManager) ExecuteWorktreeCheckoutHooks(operation string, ctx *HookContext) error
- func (hm *HookManager) RegisterPostHook(operation string, hook PostHook) error
- func (hm *HookManager) RegisterWorktreeCheckoutHook(operation string, hook WorktreeCheckoutHook) error
- type HookManagerInterface
- type PostHook
- type PreHook
- type WorktreeCheckoutHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHook ¶
type ErrorHook interface {
Hook
OnError(ctx *HookContext) error
}
ErrorHook executes when an operation fails.
type Hook ¶
type Hook interface {
Name() string
Priority() int
Execute(ctx *HookContext) error
}
Hook defines the interface for all hooks.
type HookContext ¶
type HookContext struct {
OperationName string
Parameters map[string]interface{}
Results map[string]interface{}
Error error
Metadata map[string]interface{}
}
HookContext provides context for hook execution.
type HookManager ¶
type HookManager struct {
// contains filtered or unexported fields
}
HookManager manages hook registration and execution.
func (*HookManager) ExecuteErrorHooks ¶
func (hm *HookManager) ExecuteErrorHooks(operation string, ctx *HookContext) error
ExecuteErrorHooks executes all error-hooks for a specific operation.
func (*HookManager) ExecutePostHooks ¶
func (hm *HookManager) ExecutePostHooks(operation string, ctx *HookContext) error
ExecutePostHooks executes all post-hooks for a specific operation.
func (*HookManager) ExecutePreHooks ¶
func (hm *HookManager) ExecutePreHooks(operation string, ctx *HookContext) error
ExecutePreHooks executes all pre-hooks for a specific operation.
func (*HookManager) ExecuteWorktreeCheckoutHooks ¶ added in v0.19.0
func (hm *HookManager) ExecuteWorktreeCheckoutHooks(operation string, ctx *HookContext) error
ExecuteWorktreeCheckoutHooks executes all worktree checkout hooks for a specific operation.
func (*HookManager) RegisterPostHook ¶
func (hm *HookManager) RegisterPostHook(operation string, hook PostHook) error
RegisterPostHook registers a post-hook for a specific operation.
func (*HookManager) RegisterWorktreeCheckoutHook ¶ added in v0.19.0
func (hm *HookManager) RegisterWorktreeCheckoutHook(operation string, hook WorktreeCheckoutHook) error
RegisterWorktreeCheckoutHook registers a worktree checkout hook for a specific operation.
type HookManagerInterface ¶
type HookManagerInterface interface {
// Hook registration.
RegisterPostHook(operation string, hook PostHook) error
RegisterWorktreeCheckoutHook(operation string, hook WorktreeCheckoutHook) error
// Hook execution.
ExecutePreHooks(operation string, ctx *HookContext) error
ExecutePostHooks(operation string, ctx *HookContext) error
ExecuteErrorHooks(operation string, ctx *HookContext) error
ExecuteWorktreeCheckoutHooks(operation string, ctx *HookContext) error
}
HookManagerInterface defines the interface for hook management.
func NewHookManager ¶
func NewHookManager() HookManagerInterface
NewHookManager creates a new HookManager instance.
type PostHook ¶
type PostHook interface {
Hook
PostExecute(ctx *HookContext) error
}
PostHook executes after an operation.
type PreHook ¶
type PreHook interface {
Hook
PreExecute(ctx *HookContext) error
}
PreHook executes before an operation.
type WorktreeCheckoutHook ¶ added in v0.19.0
type WorktreeCheckoutHook interface {
Hook
OnWorktreeCheckout(ctx *HookContext) error
}
WorktreeCheckoutHook executes between worktree creation and checkout.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package defaulthooks provides default hook implementations for the code manager.
|
Package defaulthooks provides default hook implementations for the code manager. |
|
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
|
Package gitcrypt provides git-crypt functionality as a hook for worktree operations. |
|
Package ide provides IDE opening functionality through hooks.
|
Package ide provides IDE opening functionality through hooks. |
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |