ui

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskForDateTime

func AskForDateTime(
	name,
	value string,
	convert func(string) (time.Time, error),
) (time.Time, error)

AskForDateTime interactively ask for one date and time from the user

func AskForDateTimeOrNil

func AskForDateTimeOrNil(
	name,
	value string,
	convert func(string) (time.Time, error),
) (*time.Time, error)

func AskForInt

func AskForInt(message string, d int) (int, error)

AskForInt interactively ask for one int from the user

func AskForText

func AskForText(message string, opts ...InputOption) (string, error)

AskForText interactively ask for one string from the user

func AskFromOptions

func AskFromOptions(message string, options []string, d string) (string, error)

AskFromOptions interactively ask the user to choose one option or none

func AskManyFromOptions

func AskManyFromOptions(message string, opts, d []string) ([]string, error)

AskManyFromOptions interactively ask the user to choose none or many option

func Confirm

func Confirm(message string, d bool) (bool, error)

Confirm interactively ask the user a yes/no question

func SetDefaultOptions added in v0.38.2

func SetDefaultOptions(opt ...survey.AskOpt)

Types

type InputOption

type InputOption func(*survey.Input)

InputOption represets a funcion the customizes a survey.Input object

func WithDefault

func WithDefault(d string) InputOption

WithDefault will set a default answer to the question

func WithHelp

func WithHelp(help string) InputOption

WithHelp add help to input question

func WithSuggestion

func WithSuggestion(fn func(toComplete string) []string) InputOption

WithSuggestion applies the suggestion function to the input question

type RGB

type RGB [3]int

func HEX

func HEX(hex string) (RGB, error)

func (RGB) B

func (c RGB) B() int

func (RGB) G

func (c RGB) G() int

func (RGB) R

func (c RGB) R() int

func (RGB) Values

func (c RGB) Values() []int

Jump to

Keyboard shortcuts

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