console

package
v0.0.0-...-5c6c3bd Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ESC_REDBRT = "\033[31;1m"
	ESC_BRIGHT = "\033[1m"
	ESC_RESET  = "\033[0m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

type Console struct {
	PromptCaret string
}

func NewConsole

func NewConsole() *Console

func (*Console) ConfirmValue

func (con *Console) ConfirmValue(
	msg string, val string, opts *InputOpts) error

func (*Console) GetDecimal

func (con *Console) GetDecimal(
	msg string, decimals int, opts *InputOpts) (float, error)

func (*Console) GetDecimalWithLimits

func (con *Console) GetDecimalWithLimits(
	msg string, decimals int,
	vmin float, vmax float, opts *InputOpts) (float, error)

func (*Console) GetNumber

func (con *Console) GetNumber(
	msg string, opts *InputOpts) (int, error)

func (*Console) GetNumberWithLimits

func (con *Console) GetNumberWithLimits(
	msg string, vmin int, vmax int, opts *InputOpts) (int, error)

func (*Console) GetValue

func (con *Console) GetValue(
	msg string, opts *InputOpts) (string, error)

read general string value

func (*Console) SelectValue

func (con *Console) SelectValue(
	msg string, values []string, opts *InputOpts) (string, error)

select string value from certain values

func (*Console) SelectYesNo

func (con *Console) SelectYesNo(
	msg string, opts *InputOpts) (bool, error)

type InputOpts

type InputOpts = struct {
	Default  any
	Required bool
	Hidden   bool
	Trials   int
	Regex    string
}

type KwArgs

type KwArgs = map[string]any

generic types

type Validator

type Validator = func(string) (any, error)

Jump to

Keyboard shortcuts

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