Documentation ¶
Index ¶
- func DefaultAndValidatePrompt(promptText string, defaultValue string, validateFunc func(string) error) (string, error)
- func DefaultPrompt(promptText string, defaultValue string) (string, error)
- func InputPassword(cliCtx *cli.Context, passwordFileFlag *cli.StringFlag, promptText string, ...) (string, error)
- func IsValidUnicode(input string) bool
- func NotEmpty(input string) error
- func PasswordPrompt(promptText string, validateFunc func(string) error) (string, error)
- func ValidateConfirmation(input string) error
- func ValidateNumber(input string) error
- func ValidatePasswordInput(input string) error
- func ValidatePrompt(promptText string, validateFunc func(string) error) (string, error)
- func ValidateYesOrNo(input string) error
- type PasswordConfirm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAndValidatePrompt ¶
func DefaultAndValidatePrompt(promptText string, defaultValue string, validateFunc func(string) error) (string, error)
DefaultAndValidatePrompt prompts the user for any text and expects it to fulfill a validation function. If nothing is entered the default value is returned.
func DefaultPrompt ¶
DefaultPrompt prompts the user for any text and performs no validation. If nothing is entered it returns the default.
func InputPassword ¶
func InputPassword( cliCtx *cli.Context, passwordFileFlag *cli.StringFlag, promptText string, confirmText string, shouldConfirmPassword PasswordConfirm, passwordValidator func(input string) error, ) (string, error)
InputPassword with a custom validator along capabilities of confirming the password and reading it from disk if a specified flag is set.
func IsValidUnicode ¶
IsValidUnicode checks if an input string is a valid unicode string comprised of only letters, numbers, punctuation, or symbols.
func NotEmpty ¶
NotEmpty is a validation function to make sure the input given isn't empty and is valid unicode.
func PasswordPrompt ¶
PasswordPrompt prompts the user for a password, that repeatedly requests the password until it qualifies the passed in validation function.
func ValidateConfirmation ¶
ValidateConfirmation makes sure the entered text is the user confirming.
func ValidateNumber ¶
ValidateNumber makes sure the entered text is a valid number.
func ValidatePasswordInput ¶
ValidatePasswordInput validates a strong password input for new accounts, including a min length, at least 1 number and at least 1 special character.
func ValidatePrompt ¶
ValidatePrompt requests the user for text and expects it to fulfil la provided validation function.
func ValidateYesOrNo ¶
ValidateYesOrNo ensures the user input either Y, y or N, n.
Types ¶
type PasswordConfirm ¶
type PasswordConfirm int
PasswordConfirm defines an enum type that can determine whether or not a prompt should confirm a password input.
const ( // NoConfirmPass enum to indicate to the prompt that confirming the password is not needed. NoConfirmPass PasswordConfirm = iota // ConfirmPass enum to indicate to the prompt to confirm the password entered. ConfirmPass )