questions

package
v0.0.0-...-02364a5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ask

type Ask struct {
	Keyboard *keyboard.Watcher
	Mouse    *mouse.Watcher
	// contains filtered or unexported fields
}

Ask provides methods for asking questions and getting user input with keyboard and mouse support

func New

func New(k *keyboard.Watcher, m *mouse.Watcher) *Ask

New creates a new Ask instance with the specified keyboard and mouse watchers

func (*Ask) ForBool

func (a *Ask) ForBool(question string) bool

ForBool prompts the user with a question and returns their boolean response It accepts "true", "false", "t", "f", "yes", "no", "y", "n", "1", "0" as valid inputs

func (*Ask) ForChoice

func (a *Ask) ForChoice(question string, choices []string) string

ForChoice prompts the user with a question and a list of choices, and returns their selection

func (*Ask) ForFloat

func (a *Ask) ForFloat(question string) float64

ForFloat prompts the user with a question and returns their float response

func (*Ask) ForInt

func (a *Ask) ForInt(question string) int

ForInt prompts the user with a question and returns their integer response

func (*Ask) ForString

func (a *Ask) ForString(question string) string

ForString prompts the user with a question and returns their string response

Jump to

Keyboard shortcuts

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