diff --git a/terminal/input/input.go b/terminal/input/input.go index c8967ce5..fa01222d 100644 --- a/terminal/input/input.go +++ b/terminal/input/input.go @@ -37,13 +37,6 @@ type HintHandler = func(input string) string // ////////////////////////////////////////////////////////////////////////////////// // -// Validator is input validator type -type Validator interface { - Validate(input string) (string, error) -} - -// ////////////////////////////////////////////////////////////////////////////////// // - // ErrKillSignal is error type when user cancel input var ErrKillSignal = linenoise.ErrKillSignal diff --git a/terminal/input/input_stubs.go b/terminal/input/input_stubs.go index 0e2f966e..84febd4d 100644 --- a/terminal/input/input_stubs.go +++ b/terminal/input/input_stubs.go @@ -25,9 +25,6 @@ type CompletionHandler = func(input string) []string // HintHandler is hint handler type HintHandler = func(input string) string -// Validator is input validation function -type Validator = func(input string) (string, error) - // ////////////////////////////////////////////////////////////////////////////////// // // ❗ ErrKillSignal is error type when user cancel input @@ -64,44 +61,8 @@ var NewLine = false // ////////////////////////////////////////////////////////////////////////////////// // -var ( - // NotEmpty returns an error if input is empty - NotEmpty = func(input string) (string, error) { return "", nil } - - // IsNumber returns an error if the input is not a valid number - IsNumber = func(input string) (string, error) { return "", nil } - - // IsFloat returns an error if the input is not a valid floating number - IsFloat = func(input string) (string, error) { return "", nil } - - // IsEmail returns an error if the input is not a valid email - IsEmail = func(input string) (string, error) { return "", nil } - - // IsURL returns an error if the input is not a valid URL - IsURL = func(input string) (string, error) { return "", nil } -) - -// ////////////////////////////////////////////////////////////////////////////////// // - -var ( - // ErrInvalidAnswer is error for wrong answer for Y/N question - ErrInvalidAnswer = errors.New("") - - // ErrIsEmpty is error for empty input - ErrIsEmpty = errors.New("") - - // ErrInvalidNumber is error for invalid number - ErrInvalidNumber = errors.New("") - - // ErrInvalidFloat is error for invalid floating number - ErrInvalidFloat = errors.New("") - - // ErrInvalidEmail is error for invalid email - ErrInvalidEmail = errors.New("") - - // ErrInvalidURL is error for invalid URL - ErrInvalidURL = errors.New("") -) +// ErrInvalidAnswer is error for wrong answer for Y/N question +var ErrInvalidAnswer = errors.New("") // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/terminal/input/input_validators.go b/terminal/input/input_validators.go index dc09ba25..20e5436c 100644 --- a/terminal/input/input_validators.go +++ b/terminal/input/input_validators.go @@ -1,6 +1,3 @@ -//go:build !windows -// +build !windows - package input // ////////////////////////////////////////////////////////////////////////////////// // @@ -18,6 +15,13 @@ import ( // ////////////////////////////////////////////////////////////////////////////////// // +// Validator is input validator type +type Validator interface { + Validate(input string) (string, error) +} + +// ////////////////////////////////////////////////////////////////////////////////// // + type notEmptyValidator struct{} type isNumberValidator struct{} type isFloatValidator struct{}