Documentation
¶
Overview ¶
Package menu renders the interactive boot-time chooser shown by cloud-boot-init before kexec. The menu lists every eligible plan target, prints a countdown, and reads a single line from the console. On timeout or empty input the default target wins.
Input grammar is deliberately tiny so the operator can pick a target with minimal typing on a serial console:
<empty> → default <number> → 1-based index into the displayed options <name> → exact match against Target.Name (case-insensitive) <name prefix> → unambiguous prefix match against Target.Name
The menu does NOT manipulate the terminal mode (no raw / no-echo): line buffering plus Enter is good enough for an initramfs console, costs no portability surface, and lets the operator correct a typo with backspace.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Out io.Writer
In io.Reader
Prompt string // header line; defaults to "Select a boot target:"
Timeout time.Duration // wall-clock budget before auto-selecting default
Default string // Option.Name returned on timeout/empty input
Options []Option
// contains filtered or unexported fields
}
Config bundles the runtime knobs of a single Prompt call. Out is where the header/countdown/options are written; In is where the operator's line is read. Timeout zero disables the auto-select branch and waits forever.