Documentation
¶
Index ¶
- func BooleanValidator(input string) (interface{}, error)
- func DirectoryValidator(input string) (interface{}, error)
- func FileValidator(input string) (interface{}, error)
- func IntegerValidator(input string) (interface{}, error)
- func PathValidator(input string) (interface{}, error)
- func Prompt(question string, validators ...ValidatorFunction) (out interface{})
- func RequiredValidator(input string) (interface{}, error)
- type ValidatorFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BooleanValidator ¶
BooleanValidator converts the input to a boolean If input is empty we return nil instead of an integer so you can set a default on your side
func DirectoryValidator ¶
DirectoryValidator ensures the input is a valid and **existing** directory Returns modified extended path
func FileValidator ¶
FileValidator ensures the input is a valid and **existing** file Returns modified extended path
func IntegerValidator ¶
IntegerValidator converts the input to a integer with strconv.Atoi If input is empty we return nil instead of an integer so you can set a default on your side
func PathValidator ¶
PathValidator ensures the input is valid looking path Returns modified extended path
func Prompt ¶
func Prompt(question string, validators ...ValidatorFunction) (out interface{})
Prompt prints the question to Stdout and checks the user input according to the provided validators
func RequiredValidator ¶
RequiredValidator ensures the input is not empty
Types ¶
type ValidatorFunction ¶
ValidatorFunction describes the simple interface every validator needs to meet