hooks

package
v0.2.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package hooks provides a system for executing scripts on task events.

Index

Constants

View Source
const (
	EventTaskBlocked = "task.blocked"
	EventTaskDone    = "task.done"
	EventTaskFailed  = "task.failed"
	EventTaskStarted = "task.started"
)

Event types for hooks

Variables

This section is empty.

Functions

func DefaultHooksDir

func DefaultHooksDir() string

DefaultHooksDir returns the default hooks directory path.

func EnsureHooksDir

func EnsureHooksDir() (string, error)

EnsureHooksDir creates the hooks directory if it doesn't exist.

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes hooks for task events.

func New

func New(hooksDir string) *Runner

New creates a new hook runner. hooksDir is typically ~/.config/task/hooks/

func NewSilent

func NewSilent(hooksDir string) *Runner

NewSilent creates a hook runner without logging.

func (*Runner) OnStatusChange

func (r *Runner) OnStatusChange(task *db.Task, newStatus, message string)

OnStatusChange triggers appropriate hooks based on status transition.

func (*Runner) Run

func (r *Runner) Run(event string, task *db.Task, message string)

Run executes hooks for the given event. Hooks are scripts in hooksDir named after the event (e.g., task.blocked)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL