Documentation ¶
Index ¶
- Constants
- func DefaultValidateFunc(_ string) error
- func FontColor(text, color string) string
- func GenMask(l int) string
- func GenStr(l int, s string) string
- func Run(model tea.Model, noTTY bool) (tea.Model, error)
- type Choice
- type Choices
- type EchoMode
- type InputModel
- func (m *InputModel) Canceled() bool
- func (m *InputModel) EchoMode() textinput.EchoMode
- func (m *InputModel) Init() tea.Cmd
- func (m *InputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *InputModel) Value() string
- func (m *InputModel) View() string
- func (m *InputModel) WithEchoMode(mode EchoMode) *InputModel
- func (m *InputModel) WithPlaceholder(placeholder string) *InputModel
- func (m *InputModel) WithValidateErrPrefix(prefix string) *InputModel
- func (m *InputModel) WithValidateFunc(fn func(string) error) *InputModel
- func (m *InputModel) WithValidateOkPrefix(prefix string) *InputModel
- func (m *InputModel) WithWidth(width int) *InputModel
- type Model
- type SelectModel
- func (m *SelectModel) Canceled() bool
- func (m *SelectModel) Init() tea.Cmd
- func (m *SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *SelectModel) Value() string
- func (m *SelectModel) View() string
- func (m *SelectModel) WithHeight(height int) *SelectModel
- func (m *SelectModel) WithWidth(width int) *SelectModel
- type TextAreaModel
- func (m *TextAreaModel) Canceled() bool
- func (m *TextAreaModel) Init() tea.Cmd
- func (m *TextAreaModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *TextAreaModel) Value() string
- func (m *TextAreaModel) View() string
- func (m *TextAreaModel) WithHeight(height int) *TextAreaModel
- func (m *TextAreaModel) WithMaxHeight(height int) *TextAreaModel
- func (m *TextAreaModel) WithPlaceholder(placeholder string) *TextAreaModel
- func (m *TextAreaModel) WithValidateErrPrefix(prefix string) *TextAreaModel
- func (m *TextAreaModel) WithValidateFunc(fn func(string) error) *TextAreaModel
- func (m *TextAreaModel) WithValidateOkPrefix(prefix string) *TextAreaModel
- func (m *TextAreaModel) WithWidth(width int) *TextAreaModel
Constants ¶
View Source
const ( DefaultValidateOkPrefix = "✔" DefaultValidateErrPrefix = "✘" DefaultTextAreaMaxHeight = 5 DefaultTextAreaHeight = 2 DefaultSelectWidth = 20 DefaultSelectHeight = 12 ColorPrompt = "2" )
View Source
const (
DefaultInputWidth = 20
)
Variables ¶
This section is empty.
Functions ¶
func DefaultValidateFunc ¶
DefaultValidateFunc is a verification function that does nothing
Types ¶
type EchoMode ¶
EchoMode sets the input behavior of the text input field. EchoMode is an alias for the textinput.EchoMode.
const ( // EchoNormal displays text as is. This is the default behavior. EchoNormal EchoMode = iota // EchoPassword displays the EchoCharacter mask instead of actual // characters. This is commonly used for password fields. EchoPassword // EchoNone displays nothing as characters are entered. This is commonly // seen for password fields on the command line. EchoNone )
type InputModel ¶
type InputModel struct {
// contains filtered or unexported fields
}
func NewInput ¶
func NewInput(label string) *InputModel
func (*InputModel) Canceled ¶
func (m *InputModel) Canceled() bool
Canceled determine whether the operation is cancelled
func (*InputModel) EchoMode ¶
func (m *InputModel) EchoMode() textinput.EchoMode
EchoMode return the input EchoMode
func (*InputModel) Init ¶
func (m *InputModel) Init() tea.Cmd
func (*InputModel) View ¶
func (m *InputModel) View() string
func (*InputModel) WithEchoMode ¶
func (m *InputModel) WithEchoMode(mode EchoMode) *InputModel
func (*InputModel) WithPlaceholder ¶
func (m *InputModel) WithPlaceholder(placeholder string) *InputModel
func (*InputModel) WithValidateErrPrefix ¶
func (m *InputModel) WithValidateErrPrefix(prefix string) *InputModel
func (*InputModel) WithValidateFunc ¶
func (m *InputModel) WithValidateFunc(fn func(string) error) *InputModel
func (*InputModel) WithValidateOkPrefix ¶
func (m *InputModel) WithValidateOkPrefix(prefix string) *InputModel
func (*InputModel) WithWidth ¶
func (m *InputModel) WithWidth(width int) *InputModel
type SelectModel ¶
type SelectModel struct {
// contains filtered or unexported fields
}
func NewSelect ¶
func NewSelect(label string, choices Choices) *SelectModel
func (*SelectModel) Canceled ¶
func (m *SelectModel) Canceled() bool
func (*SelectModel) Init ¶
func (m *SelectModel) Init() tea.Cmd
func (*SelectModel) Value ¶
func (m *SelectModel) Value() string
func (*SelectModel) View ¶
func (m *SelectModel) View() string
func (*SelectModel) WithHeight ¶
func (m *SelectModel) WithHeight(height int) *SelectModel
func (*SelectModel) WithWidth ¶
func (m *SelectModel) WithWidth(width int) *SelectModel
type TextAreaModel ¶
type TextAreaModel struct {
// contains filtered or unexported fields
}
func NewTextArea ¶
func NewTextArea(label string) *TextAreaModel
func (*TextAreaModel) Canceled ¶
func (m *TextAreaModel) Canceled() bool
Canceled determine whether the operation is cancelled
func (*TextAreaModel) Init ¶
func (m *TextAreaModel) Init() tea.Cmd
func (*TextAreaModel) View ¶
func (m *TextAreaModel) View() string
func (*TextAreaModel) WithHeight ¶
func (m *TextAreaModel) WithHeight(height int) *TextAreaModel
func (*TextAreaModel) WithMaxHeight ¶
func (m *TextAreaModel) WithMaxHeight(height int) *TextAreaModel
func (*TextAreaModel) WithPlaceholder ¶
func (m *TextAreaModel) WithPlaceholder(placeholder string) *TextAreaModel
func (*TextAreaModel) WithValidateErrPrefix ¶
func (m *TextAreaModel) WithValidateErrPrefix(prefix string) *TextAreaModel
func (*TextAreaModel) WithValidateFunc ¶
func (m *TextAreaModel) WithValidateFunc(fn func(string) error) *TextAreaModel
func (*TextAreaModel) WithValidateOkPrefix ¶
func (m *TextAreaModel) WithValidateOkPrefix(prefix string) *TextAreaModel
func (*TextAreaModel) WithWidth ¶
func (m *TextAreaModel) WithWidth(width int) *TextAreaModel
Source Files ¶
Click to show internal directories.
Click to hide internal directories.