notify

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package notify posts desktop notifications. It is a leaf package — below internal/cli, internal/tui, and internal/policy — so a backup run notifies identically from every surface, including the launchd and systemd timers that invoke `sentra policy run` with no terminal attached.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Desktop

func Desktop(ctx context.Context, run Runner, goos, title, subtitle, body string) error

Desktop posts one notification for goos via run. Unsupported platforms make no call and return nil; a nil run is a silent no-op. The runner's error is returned wrapped so the caller can log it — by contract the caller never lets it mask the outcome being reported.

On darwin the title, subtitle, and body travel as argv into an `on run argv` handler rather than being spliced into the AppleScript source: a policy name or error text containing quotes or backslashes would otherwise terminate the string literal and run as script.

func ExecRunner

func ExecRunner(ctx context.Context, name string, args ...string) ([]byte, error)

ExecRunner is the production Runner: os/exec with a hard timeout.

Types

type Runner

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

Runner executes one notifier command and returns its combined output. Production passes ExecRunner. A nil Runner means notifications are OFF: this deliberately differs from scheduler.Runner, whose nil selects the real thing. A missing timer activation is a broken feature the operator notices at once; a missing notification is not, and the failure mode of the other default is every test that runs a backup popping a real notification on the developer's desktop. So a zero-value Deps is silent and production wires ExecRunner explicitly (guarded by a test).

Jump to

Keyboard shortcuts

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