input

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyValue    = errors.New("empty input value")
	ErrInvalidSymbol = errors.New("invalid symbol")
)

Functions

func ValidateB64

func ValidateB64(s string) error

func ValidateHex

func ValidateHex(s string) error

ValidateHex validates hex input

Types

type CanceledMsg

type CanceledMsg struct{}

type DoneMsg

type DoneMsg struct {
	Value string
}

type ErrorMsg

type ErrorMsg struct {
	Err error
}

type InvalidMsg

type InvalidMsg struct {
	Value string
	Err   error
}

type StyleFn

type StyleFn func(m *textinput.Model)

type ValidatedInput

type ValidatedInput struct {
	textinput.Model
	// contains filtered or unexported fields
}

ValidatedInput provides the input with validation

func NewValidatedInput

func NewValidatedInput(validationFn func(string) error, setValidStyleFn, setInvalidStyleFn StyleFn) *ValidatedInput

NewValidatedInput creates new input model

func (*ValidatedInput) Init

func (m *ValidatedInput) Init() tea.Cmd

Init model

func (*ValidatedInput) Input

func (m *ValidatedInput) Input() *textinput.Model

TextInput provides the access to input model

func (*ValidatedInput) IsValid

func (m *ValidatedInput) IsValid() bool

IsValid indicates if input value is valid

func (*ValidatedInput) Update

func (m *ValidatedInput) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update updates tea model

func (*ValidatedInput) Value

func (m *ValidatedInput) Value() string

Value returns result value

func (*ValidatedInput) View

func (m *ValidatedInput) View() string

View shows tea model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL