Documentation
¶
Index ¶
- Variables
- func InfoLog(message string) string
- func Required(s string) (string, error)
- func ValidateFilePath(path string, opt FileValidatorOptions) error
- func WarnLog(message string) string
- type FilePicker
- type FileValidatorOptions
- type IOStreams
- type InputPrompt
- type InputSourceSwitch
- type MultiSelect
- type SingleSelect
- type TextInput
- type ValidateAndMap
- type ValidateTextAndMapFn
- type Zeroable
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInterrupted = errors.New("input was interrupted")
)
View Source
var (
ErrValueIsNotSet = errors.New("value is not set")
)
Functions ¶
func ValidateFilePath ¶
func ValidateFilePath(path string, opt FileValidatorOptions) error
Types ¶
type FilePicker ¶
type FileValidatorOptions ¶
type IOStreams ¶
func NewTestIOStreams ¶ added in v0.23.1
func (IOStreams) IsInteractive ¶
type InputPrompt ¶
type InputSourceSwitch ¶
type InputSourceSwitch[V, T any] struct { DefaultValue Zeroable[V] Optional bool InteractivePromptFn func() (InputPrompt[V], error) ValidateAndMap ValidateAndMap[V, T] ErrMessage string // contains filtered or unexported fields }
func (*InputSourceSwitch[V, T]) GetValue ¶
func (iss *InputSourceSwitch[V, T]) GetValue(streams IOStreams) (T, error)
func (*InputSourceSwitch[V, T]) Validate ¶
func (iss *InputSourceSwitch[V, T]) Validate(streams IOStreams) error
type MultiSelect ¶
type MultiSelect struct {
Prompt string
Items []string
ValidateAndMap ValidateAndMap[[]string, []string]
}
type SingleSelect ¶
type TextInput ¶
type TextInput[V interface{}] struct {
Prompt string
InitialValue string
Placeholder string
ValidateAndMap ValidateTextAndMapFn[V]
}
type ValidateAndMap ¶
func NewFileValidator ¶
func NewFileValidator(opt FileValidatorOptions) ValidateAndMap[string, string]
type ValidateTextAndMapFn ¶
type Zeroable ¶
Zeroable this interface is required to check if a value is not set we could use simply "comparable" as generic constraint, but slices are not comparable, which makes them impossible to use. This interface abstracts helps mitigate the issue
func AsZeroable ¶
func AsZeroable[V comparable](value V) Zeroable[V]
func AsZeroableSlice ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.