notify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package notify implements the "notify" built-in hook, which sends a desktop notification on each subscribed lifecycle event. The OS backend is selected at runtime:

  • macOS: osascript with a display-notification AppleScript one-liner
  • Linux: notify-send
  • other: silently no-ops

The system command is dispatched through an injectable Runner so the hook can be tested without spawning OS processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMessage

func BuildMessage(event hooksreg.Event, env map[string]string) string

BuildMessage constructs the human-readable notification body from the event and its context environment variables.

func DefaultRunner

func DefaultRunner(ctx context.Context, name string, args ...string) error

DefaultRunner is the production Runner that execs the OS notification tool. On failure the combined stdout+stderr output is captured (truncated via hooksreg.TruncateOutput) and included in the returned error so the actual cause is visible instead of a bare "exit status 1".

func New

func New(runner Runner) hooksreg.Hook

New returns a hooksreg.Hook that sends a desktop notification for every event it receives. runner is called to execute the OS command.

Types

type Runner

type Runner func(ctx context.Context, name string, args ...string) error

Runner executes the notification command. Receives the context, the command name, and its arguments. The injectable seam makes tests deterministic.

Source Files

  • notify.go

Jump to

Keyboard shortcuts

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