dialog

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dialog implements macOS human-in-the-loop dialogs via osascript.

Index

Constants

View Source
const (
	MaxPresetOptions = maxAlertButtons - 1 // preset --option count (Customize is always added)
)

Variables

View Source
var ErrDismissed = errors.New("dialog dismissed")

ErrDismissed indicates the user cancelled or closed the dialog.

Functions

func Escape

func Escape(s string) string

Escape turns arbitrary text into a safe AppleScript string literal fragment.

func ParseOsascriptOutput

func ParseOsascriptOutput(output string) (button, text string, err error)

ParseOsascriptOutput extracts button and text from osascript stdout. display dialog often returns both fields on one line: "button returned:OK, text returned:hello"

Types

type AskRequest

type AskRequest struct {
	Title        string
	Message      string
	Options      []string
	AffirmOption string
	CancelOption string
}

AskRequest describes a two-step human checkpoint dialog.

type AskResult

type AskResult struct {
	Answer   string
	Via      string // "button" | "free_text" | "dismissed"
	Affirmed *bool
}

AskResult is the structured answer from Ask.

func Ask

func Ask(req AskRequest) (AskResult, error)

Ask presents the human checkpoint dialog and returns the user's answer.

Jump to

Keyboard shortcuts

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