prompt

package
v0.0.0-...-873fb03 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PasswordType = "password"

Variables

View Source
var (
	BoolOpts = map[string]bool{
		"yes":   true,
		"no":    false,
		"true":  true,
		"false": false,
		"Yes":   true,
		"No":    false,
		"True":  true,
		"False": false,
		"✅ Yes": true,
		"❌ No":  false,
	}
)
View Source
var ErrInvalidNumber = errors.New("invalid number")

Functions

func Bold

func Bold(text string) string

func Cyan

func Cyan(text string) string

func Error

func Error(text string)

Error is a Println with red message

func Green

func Green(text string) string

func Info

func Info(text string)

func NewError

func NewError(text string) error

NewError returns new error with red message

func Red

func Red(text string) string

Red returns a red string

func Success

func Success(text string)

func Warning

func Warning(text string)

func Yellow

func Yellow(text string) string

Types

type InputAutocomplete

type InputAutocomplete struct{}

func NewInputAutocomplete

func NewInputAutocomplete() InputAutocomplete

func (InputAutocomplete) Read

func (InputAutocomplete) Read(text string) (string, error)

type InputBool

type InputBool interface {
	Bool(name string, items []string, helper ...string) (bool, error)
}

type InputEmail

type InputEmail interface {
	Email(name string) (string, error)
}

type InputInt

type InputInt interface {
	Int(name string, helper ...string) (int64, error)
}

type InputList

type InputList interface {
	List(name string, items []string, helper ...string) (string, error)
}

type InputMultiline

type InputMultiline interface {
	MultiLineText(name string, required bool) (string, error)
}

type InputMultiselect

type InputMultiselect interface {
	Multiselect(input formula.Input) ([]string, error)
}

type InputPassword

type InputPassword interface {
	Password(label string, helper ...string) (string, error)
}

type InputPath

type InputPath interface {
	Read(text string) (string, error)
}

type InputText

type InputText interface {
	Text(name string, required bool, helper ...string) (string, error)
}

type InputTextValidator

type InputTextValidator interface {
	Text(name string, validate func(interface{}) error, helper ...string) (string, error)
}

type InputURL

type InputURL interface {
	URL(name, defaultValue string) (string, error)
}

type SurveyBool

type SurveyBool struct{}

func NewSurveyBool

func NewSurveyBool() SurveyBool

func (SurveyBool) Bool

func (SurveyBool) Bool(name string, items []string, helper ...string) (bool, error)

type SurveyEmail

type SurveyEmail struct{}

func NewSurveyEmail

func NewSurveyEmail() SurveyEmail

func (SurveyEmail) Email

func (SurveyEmail) Email(name string) (string, error)

type SurveyInt

type SurveyInt struct{}

func NewSurveyInt

func NewSurveyInt() SurveyInt

func (SurveyInt) Int

func (SurveyInt) Int(name string, helper ...string) (int64, error)

type SurveyList

type SurveyList struct{}

func NewSurveyList

func NewSurveyList() SurveyList

func (SurveyList) List

func (SurveyList) List(name string, items []string, helper ...string) (string, error)

List show a prompt with options and parse to string.

type SurveyMultiline

type SurveyMultiline struct{}

func NewSurveyMultiline

func NewSurveyMultiline() SurveyMultiline

func (SurveyMultiline) MultiLineText

func (SurveyMultiline) MultiLineText(name string, required bool) (string, error)

type SurveyMultiselect

type SurveyMultiselect struct{}

func NewSurveyMultiselect

func NewSurveyMultiselect() SurveyMultiselect

func (SurveyMultiselect) Multiselect

func (SurveyMultiselect) Multiselect(in formula.Input) ([]string, error)

type SurveyPassword

type SurveyPassword struct{}

func NewSurveyPassword

func NewSurveyPassword() SurveyPassword

func (SurveyPassword) Password

func (SurveyPassword) Password(label string, helper ...string) (string, error)

type SurveyText

type SurveyText struct{}

func NewSurveyText

func NewSurveyText() SurveyText

func (SurveyText) Text

func (SurveyText) Text(name string, required bool, helper ...string) (string, error)

type SurveyTextValidator

type SurveyTextValidator struct{}

func NewSurveyTextValidator

func NewSurveyTextValidator() SurveyTextValidator

func (SurveyTextValidator) Text

func (SurveyTextValidator) Text(name string, validate func(interface{}) error, helper ...string) (string, error)

type SurveyURL

type SurveyURL struct{}

func NewSurveyURL

func NewSurveyURL() SurveyURL

func (SurveyURL) URL

func (SurveyURL) URL(name, defaultValue string) (string, error)

Jump to

Keyboard shortcuts

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