accessibility

package
v2.0.0-...-df2a688 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package accessibility provides accessible functions to capture user input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromptBool

func PromptBool(
	out io.Writer,
	in io.Reader,
	prompt string,
	defaultValue bool,
) bool

PromptBool prompts a user for a boolean value.

Given invalid input (non-boolean), the user will continue to be reprompted until a valid input is given, ensuring that the return value is always valid.

func PromptInt

func PromptInt(
	out io.Writer,
	in io.Reader,
	prompt string,
	low, high int,
	defaultValue *int,
) int

PromptInt prompts a user for an integer between a certain range.

Given invalid input (non-integers, integers outside of the range), the user will continue to be reprompted until a valid input is given, ensuring that the return value is always valid.

func PromptPassword

func PromptPassword(
	out io.Writer,
	in uintptr,
	prompt string,
	validator func(input string) error,
) (string, error)

PromptPassword allows to prompt for a password. In must be the fd of a tty.

func PromptString

func PromptString(
	out io.Writer,
	in io.Reader,
	prompt string,
	defaultValue string,
	validator func(input string) error,
) string

PromptString prompts a user for a string value and validates it against a validator function. It re-prompts the user until a valid input is given.

Types

This section is empty.

Jump to

Keyboard shortcuts

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