Documentation
¶
Overview ¶
Package dialog is a small, dependency-free homage to the chunky gray message boxes that classic Windows admin tools flung all over Windows 9x — the kind an overnight script loved to leave waiting on a locked workstation at 3 a.m. It renders that look in the terminal: a double-ruled window, a fake title bar with [_][#][X] controls, an icon gutter, and chunky buttons.
It draws a dialog; it does not pop a real GUI window. That is the joke — and also why it works the same on every platform with zero dependencies. Render() returns the box as a string (so it is trivially testable); the Message / Warn / ErrorBox / AskYesNo helpers print it for you.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskYesNo ¶
AskYesNo renders a Yes/No question and reads the answer from stdin. Anything starting with 'y' is yes; the default (bare Enter / EOF) is no.
func Classic ¶
func Classic()
Classic is the easter egg: the exact flavor of dialog overnight installer jobs used to fling at half the office every morning — drawn here in loving, slightly cursed ASCII.
func Splash ¶
func Splash(title, status string)
Splash prints a button-less "loading" box — the terminal descendant of the splash/status boxes overnight installers threw up while they worked. status is the action line, e.g. "Installing Acme Toolbar"; an empty status falls back to "Working".
Types ¶
type Dialog ¶
type Dialog struct {
Title string // title-bar text (default "WinAdmin")
Message string // body text; '\n' forces a line break, the rest word-wraps
Buttons []string // button labels (default ["OK"])
Default int // index of the focused/default button
Icon Icon // gutter glyph
Width int // body wrap width hint; 0 = a sensible default
// contains filtered or unexported fields
}
Dialog is a single message box. The zero value renders an empty OK box titled "WinAdmin"; set the fields you care about.