Documentation
¶
Index ¶
- Variables
- type ChooseModel
- type InputLimit
- type InputModel
- func (m InputModel) Data() any
- func (m InputModel) DataString() string
- func (m InputModel) Init() tea.Cmd
- func (m InputModel) KeyBindings() []key.Binding
- func (m *InputModel) SetInputLimit(inputLimit InputLimit) *InputModel
- func (m InputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m InputModel) View() string
- type ListHandler
- type ListStyle
- type MultiChooseModel
- type Prompt
- func (p *Prompt) Ask(message string) *Prompt
- func (p Prompt) Choose(choices []string) (string, error)
- func (p Prompt) ChooseWithStyle(choices []string, style *ListStyle) (string, error)
- func (p *Prompt) Error() error
- func (m Prompt) Init() tea.Cmd
- func (p Prompt) Input(defaultValue string) (string, error)
- func (p Prompt) InputWithLimit(defaultValue string, inputLimit InputLimit) (string, error)
- func (p Prompt) Model() PromptModel
- func (p Prompt) MultiChoose(choices []string) ([]string, error)
- func (p Prompt) MultiChooseWithStyle(choices []string, style *ListStyle) ([]string, error)
- func (p *Prompt) Run() (PromptModel, error)
- func (p *Prompt) SetHelpVisible(visible bool) *Prompt
- func (p *Prompt) SetModel(pm PromptModel) *Prompt
- func (p Prompt) Toggle(choices []string) (string, error)
- func (p Prompt) ToggleWithStyle(choices []string, style *ListStyle) (string, error)
- func (m Prompt) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (p Prompt) View() string
- type PromptModel
- type ToggleModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrModelConversion = errors.New("model conversion failed") ErrUserQuit = errors.New("user quit prompt") )
View Source
var ( DefaultNormalPromptPrefix = "?" DefaultFinishPromptPrefix = "✔" DefaultNormalPromptSuffix = "›" DefaultFinishPromptSuffix = "…" DefaultNormalPromptPrefixStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("14")) DefaultFinishPromptPrefixStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("10")) DefaultNormalPromptSuffixStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("6")) DefaultFinishPromptSuffixStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("6")) DefaultItemStyle = lipgloss.NewStyle() DefaultSelectedItemStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("14")) DefaultChoiceStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("14")) )
Functions ¶
This section is empty.
Types ¶
type ChooseModel ¶
type ChooseModel struct {
ListHandler
// contains filtered or unexported fields
}
func NewChooseModel ¶
func NewChooseModel(choices []string) *ChooseModel
func NewChooseModelWithStyle ¶
func NewChooseModelWithStyle(choices []string, style *ListStyle) *ChooseModel
func (ChooseModel) Data ¶
func (m ChooseModel) Data() any
func (ChooseModel) DataString ¶
func (m ChooseModel) DataString() string
func (ChooseModel) Init ¶
func (m ChooseModel) Init() tea.Cmd
func (ChooseModel) KeyBindings ¶
func (m ChooseModel) KeyBindings() []key.Binding
func (ChooseModel) View ¶
func (m ChooseModel) View() string
type InputModel ¶
type InputModel struct {
ItemStyle lipgloss.Style
SelectedItemStyle lipgloss.Style
ChoiceStyle lipgloss.Style
// contains filtered or unexported fields
}
func NewInputModel ¶
func NewInputModel(defaultValue string) *InputModel
func (InputModel) Data ¶
func (m InputModel) Data() any
func (InputModel) DataString ¶
func (m InputModel) DataString() string
func (InputModel) Init ¶
func (m InputModel) Init() tea.Cmd
func (InputModel) KeyBindings ¶
func (m InputModel) KeyBindings() []key.Binding
func (*InputModel) SetInputLimit ¶
func (m *InputModel) SetInputLimit(inputLimit InputLimit) *InputModel
func (InputModel) View ¶
func (m InputModel) View() string
type ListHandler ¶
type ListHandler struct {
// contains filtered or unexported fields
}
func NewListHandler ¶
func NewListHandler(choiceCount int, style *ListStyle) *ListHandler
func (ListHandler) Cursor ¶
func (h ListHandler) Cursor() int
func (*ListHandler) MoveNext ¶
func (h *ListHandler) MoveNext()
func (*ListHandler) MovePrev ¶
func (h *ListHandler) MovePrev()
func (ListHandler) Style ¶
func (h ListHandler) Style() *ListStyle
type ListStyle ¶
type ListStyle struct {
ItemStyle lipgloss.Style
SelectedItemStyle lipgloss.Style
ChoiceStyle lipgloss.Style
}
func NewListStyle ¶
func NewListStyle() *ListStyle
type MultiChooseModel ¶
type MultiChooseModel struct {
ListHandler
// contains filtered or unexported fields
}
func NewMultiChooseModel ¶
func NewMultiChooseModel(choices []string) *MultiChooseModel
func NewMultiChooseModelWithStyle ¶
func NewMultiChooseModelWithStyle(choices []string, style *ListStyle) *MultiChooseModel
func (MultiChooseModel) Data ¶
func (m MultiChooseModel) Data() any
func (MultiChooseModel) DataString ¶
func (m MultiChooseModel) DataString() string
func (MultiChooseModel) Init ¶
func (m MultiChooseModel) Init() tea.Cmd
func (MultiChooseModel) KeyBindings ¶
func (m MultiChooseModel) KeyBindings() []key.Binding
func (MultiChooseModel) View ¶
func (m MultiChooseModel) View() string
type Prompt ¶
type Prompt struct {
// Style
Message string
NormalPrefix string
FinishPrefix string
NormalSuffix string
FinishSuffix string
PrefixStyle lipgloss.Style
FinishPrefixStyle lipgloss.Style
SuffixStyle lipgloss.Style
FinishSuffixStyle lipgloss.Style
// contains filtered or unexported fields
}
func (Prompt) ChooseWithStyle ¶
func (Prompt) InputWithLimit ¶
func (p Prompt) InputWithLimit(defaultValue string, inputLimit InputLimit) (string, error)
func (Prompt) Model ¶
func (p Prompt) Model() PromptModel
func (Prompt) MultiChooseWithStyle ¶
func (*Prompt) Run ¶
func (p *Prompt) Run() (PromptModel, error)
func (*Prompt) SetHelpVisible ¶
func (*Prompt) SetModel ¶
func (p *Prompt) SetModel(pm PromptModel) *Prompt
func (Prompt) ToggleWithStyle ¶
type PromptModel ¶
type ToggleModel ¶
type ToggleModel struct {
ListHandler
// contains filtered or unexported fields
}
func NewToggleModel ¶
func NewToggleModel(choices []string) *ToggleModel
func NewToggleModelWithStyle ¶
func NewToggleModelWithStyle(choices []string, style *ListStyle) *ToggleModel
func (ToggleModel) Data ¶
func (m ToggleModel) Data() any
func (ToggleModel) DataString ¶
func (m ToggleModel) DataString() string
func (ToggleModel) Init ¶
func (m ToggleModel) Init() tea.Cmd
func (ToggleModel) KeyBindings ¶
func (m ToggleModel) KeyBindings() []key.Binding
func (ToggleModel) View ¶
func (m ToggleModel) View() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.




