Help us shape the future of Go! Take the 2026 Go Developer Survey

ui

package
v0.18.18 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPrompt = "Enter option number (or 0 to cancel): "
)

Variables

This section is empty.

Functions

func DisplayNumberedList

func DisplayNumberedList(items []string)

DisplayNumberedList displays a numbered list of options

func DisplayNumberedListWithDescriptions

func DisplayNumberedListWithDescriptions(options []NumericPromptOption)

DisplayNumberedListWithDescriptions displays a numbered list with descriptions

func PromptForConfirmation

func PromptForConfirmation(prompt string) bool

PromptForConfirmation prompts the user for yes/no confirmation Supports y, yes, Y, YES (yes) and anything else (no)

func PromptForSelection

func PromptForSelection(options []string, prompt string) (int, bool)

PromptForSelection prompts the user to select from a numbered list of options Returns the 1-based index of the selected option, or 0 if cancelled, and ok=true if valid

func PromptForSelectionWithOptions

func PromptForSelectionWithOptions(options []NumericPromptOption, prompt string) (int, bool)

PromptForSelectionWithOptions prompts user to select from typed options

Types

type NumericPromptOption

type NumericPromptOption struct {
	Index       int
	DisplayName string
	Description string
	Value       string
}

NumericPromptOption represents a single option in a numeric prompt

Jump to

Keyboard shortcuts

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