textinput

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWidth = 50
	DefaultHint  = "(Enter to submit, esc to quit)"
)

Variables

This section is empty.

Functions

func Confirm

func Confirm(prompt string, defaultValue string) (bool, error)

Confirm asks for y/n with default and inline error when invalid value entered.

func Prompt

func Prompt(
	prompt string,
	defaultValue string,
) (string, error)

Prompt executes the text input UI.

func PromptValidate

func PromptValidate(
	prompt string,
	defaultValue string,
	validate func(string) (string, error),
) (string, error)

PromptValidate executes the text input UI with a custom validator. The validator is called when the user presses Enter. If it returns an error, the error message is shown inline beneath the input. If it returns a value and no error, the potentially-normalized value is accepted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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