pmt

package
v0.0.0-...-43a96cf Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FAIL_MSG                            = "prompt failed %v"
	INVALID_INT                         = "invalid int"
	PARSE_INT_FAIL                      = "parse int failed %v"
	REGEX_CHECK_FAIL                    = "input value failed to match with expected pattern (%v)"
	REGEX_CHECK_FAIL_WITH_SAMPLE_STRING = "regex check failed. sample value: %v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompt

type Prompt interface {
	Confirm(question, trueOption, falseOption string) (result bool, err error)
	Select(question string, options ...string) (index int, result string, err error)
	SelectSearch(question string, options ...string) (index int, result string, err error)
	SelectAdd(question string, addLabel string, options ...string) (index int, result string, err error)
	InputInt64(label string) (resultVal int64, err error)
	InputInt(label string) (resultVal int, err error)
	InputIntDefault(label string, defVal int) (resultVal int, err error)
	InputIntDefaultValidation(label string, defVal int, valFunc func(input string) error) (resultVal int, err error)
	InputIntRange(label string, min, max int) (resultVal int, err error)
	InputIntDefaultRange(label string, defVal, min, max int) (resultVal int, err error)
	InputFloat64(label string) (resultVal float64, err error)
	InputStringMinMax(label string, minlen int, maxlen int) (result string, err error)
	InputWordDefault(label string, defaultVal string) (result string, err error)
	InputWord(label string) (result string, err error)
	InputStringRegex(label string, regexCheck string) (result string, err error)
	InputStringRegexErrMsg(label string, regexCheck string, errMsg string) (result string, err error)
	InputString(label string) (result string, err error)
	InputStringRequired(label string) (result string, err error)
	InputPassword(label string) (result string, err error)
	InputPasswordRegex(label string, regexCheck string) (result string, err error)
	InputPasswordRegexErrMsg(label string, regexCheck string, errMsg string) (result string, err error)
	InputStringRegexDefault(label string, regexCheck string, defaultVal string) (result string, err error)
	InputStringRegexDefaultErrMsg(label string, regexCheck string, defaultVal string, errMsg string) (result string, err error)
	InputStringDefault(label string, defaultVal string) (result string, err error)
	InputExistingFilePathDefault(label string, defaultVal string) (result string, err error)
	InputExistingFilePath(label string) (result string, err error)
}

type PromptImp

type PromptImp struct {
	Stdin     io.ReadCloser
	Stdout    io.WriteCloser
	FileUtils fileutils.FileUtils
}

func PromptFactory

func PromptFactory(in io.ReadCloser, out io.WriteCloser, fu fileutils.FileUtils) *PromptImp

func (*PromptImp) Confirm

func (p *PromptImp) Confirm(question, trueOption, falseOption string) (resultVal bool, err error)

func (*PromptImp) InputExistingFilePath

func (p *PromptImp) InputExistingFilePath(label string) (result string, err error)

func (*PromptImp) InputExistingFilePathDefault

func (p *PromptImp) InputExistingFilePathDefault(label string, defaultVal string) (result string, err error)

func (*PromptImp) InputFloat64

func (p *PromptImp) InputFloat64(label string) (resultVal float64, err error)

func (*PromptImp) InputInt

func (p *PromptImp) InputInt(label string) (resultVal int, err error)

func (*PromptImp) InputInt64

func (p *PromptImp) InputInt64(label string) (resultVal int64, err error)

func (*PromptImp) InputIntDefault

func (p *PromptImp) InputIntDefault(label string, defVal int) (resultVal int, err error)

func (*PromptImp) InputIntDefaultRange

func (p *PromptImp) InputIntDefaultRange(label string, defVal, min, max int) (resultVal int, err error)

func (*PromptImp) InputIntDefaultValidation

func (p *PromptImp) InputIntDefaultValidation(label string, defVal int, valFunc func(input string) error) (resultVal int, err error)

func (*PromptImp) InputIntRange

func (p *PromptImp) InputIntRange(label string, min, max int) (resultVal int, err error)

func (*PromptImp) InputPassword

func (p *PromptImp) InputPassword(label string) (result string, err error)

func (*PromptImp) InputPasswordRegex

func (p *PromptImp) InputPasswordRegex(label string, regexCheck string) (result string, err error)

func (*PromptImp) InputPasswordRegexErrMsg

func (p *PromptImp) InputPasswordRegexErrMsg(label string, regexCheck string, errMsg string) (result string, err error)

func (*PromptImp) InputString

func (p *PromptImp) InputString(label string) (result string, err error)

func (*PromptImp) InputStringDefault

func (p *PromptImp) InputStringDefault(label string, defaultVal string) (result string, err error)

func (*PromptImp) InputStringMinMax

func (p *PromptImp) InputStringMinMax(label string, minlen int, maxlen int) (result string, err error)

func (*PromptImp) InputStringRegex

func (p *PromptImp) InputStringRegex(label string, regexCheck string) (result string, err error)

func (*PromptImp) InputStringRegexDefault

func (p *PromptImp) InputStringRegexDefault(label string, regexCheck string, defaultVal string) (result string, err error)

func (*PromptImp) InputStringRegexDefaultErrMsg

func (p *PromptImp) InputStringRegexDefaultErrMsg(label string, regexCheck string, defaultVal string, errMsg string) (result string, err error)

func (*PromptImp) InputStringRegexErrMsg

func (p *PromptImp) InputStringRegexErrMsg(label string, regexCheck string, errMsg string) (result string, err error)

func (*PromptImp) InputStringRequired

func (p *PromptImp) InputStringRequired(label string) (result string, err error)

func (*PromptImp) InputWord

func (p *PromptImp) InputWord(label string) (result string, err error)

func (*PromptImp) InputWordDefault

func (p *PromptImp) InputWordDefault(label string, defaultVal string) (result string, err error)

func (*PromptImp) Select

func (p *PromptImp) Select(question string, options ...string) (index int, result string, err error)

func (*PromptImp) SelectAdd

func (p *PromptImp) SelectAdd(question string, addLabel string, options ...string) (index int, result string, err error)

func (*PromptImp) SelectSearch

func (p *PromptImp) SelectSearch(question string, options ...string) (index int, result string, err error)

Jump to

Keyboard shortcuts

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