tui

package
v0.7.15 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = errors.New("cancelled")

ErrCancelled is returned when the user cancels input (Ctrl+C or Esc).

View Source
var ErrNoTTY = errors.New("no interactive terminal available")

ErrNoTTY is returned when a TUI prompt is called without an interactive terminal.

Functions

func Confirm

func Confirm(label string, defaultYes bool) (bool, error)

Confirm presents a y/n prompt and returns the boolean result. Returns ErrCancelled if the user presses Ctrl+C or Esc. Returns ErrNoTTY if stdin is not a terminal.

func PromptHidden

func PromptHidden(label string) (string, error)

PromptHidden prompts the user for hidden input (e.g. API keys). Returns ErrCancelled if the user presses Ctrl+C or Esc. Returns ErrNoTTY if stdin is not a terminal.

func PromptText

func PromptText(label, defaultVal string) (string, error)

PromptText prompts for text input with an optional default value shown as placeholder. If the user enters nothing and presses Enter, the default value is returned. Returns ErrCancelled if the user presses Ctrl+C or Esc.

func SelectFromList

func SelectFromList(label string, items []string) (int, error)

SelectFromList presents a list of items and returns the selected index. Returns ErrCancelled if the user presses Ctrl+C or Esc.

Types

This section is empty.

Jump to

Keyboard shortcuts

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