Documentation ¶
Overview ¶
Package input ...
Index ¶
- func Run(cfg *Config) (string, error)
- func ValidateAlphanumeric(s string) error
- func ValidateDigits(s string) error
- func ValidateEmail(s string) error
- func ValidateFloat(s string) error
- func ValidateInteger(s string) error
- func ValidateURL(s string) error
- type Config
- type Styles
- type ValidateFunc
- type ValidationRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateAlphanumeric ¶
ValidateAlphanumeric is the validation function to validate an alphanumeric string.
func ValidateDigits ¶
ValidateDigits is the validation function to validate a digits only string.
func ValidateEmail ¶
ValidateEmail is the validation function to validate an email address string.
func ValidateFloat ¶
ValidateFloat is the validation function to validate a float string.
func ValidateInteger ¶
ValidateInteger is the validation function to validate an integer string.
func ValidateURL ¶
ValidateURL is the validation function to validate an URL string.
Types ¶
type Config ¶
type Config struct { Message string Placeholder string Initial string ErrorMsg string Password bool ValidateFunc ValidateFunc ShowResult bool Styles Styles }
Config represents the struct to configure the tui input.
type Styles ¶
type Styles struct { PrefixIcon string PrefixIconColor lipgloss.AdaptiveColor PromptStyle lipgloss.Style TextStyle lipgloss.Style BackgroundStyle lipgloss.Style PlaceholderStyle lipgloss.Style CursorStyle lipgloss.Style }
Styles is the struct representing the style configuration options.
type ValidateFunc ¶
ValidateFunc is a function that returns an error if the input is invalid.
type ValidationRule ¶
type ValidationRule string
ValidationRule is an alias for string representing a validation rule.
const ( // Alphanumeric is the string representing the alphanumeric validation rule. Alphanumeric ValidationRule = "alphanumeric" // DigitsOnly is the string representing the alphanumeric validation rule. DigitsOnly ValidationRule = "digits" // Integers is the string representing the alphanumeric validation rule. Integers ValidationRule = "integers" // Floats is the string representing the alphanumeric validation rule. Floats ValidationRule = "floats" // EmailAddress is the string representing the alphanumeric validation rule. EmailAddress ValidationRule = "email" // URL is the string representing the alphanumeric validation rule. URL ValidationRule = "url" )