dialog

package
v0.0.239 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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