Documentation ¶
Index ¶
- func ChangeState(name string) tea.Cmd
- type App
- func (a *App) Add(name string, m tea.Model)
- func (a *App) Get(name string) tea.Model
- func (a *App) Init() tea.Cmd
- func (a *App) Register(name string, m tea.Model)
- func (a *App) SetDelegate(f UpdateFunc)
- func (a *App) SetFocus(name string)
- func (a *App) SetInit(f func() tea.Cmd)
- func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (a *App) View() string
- type Box
- type BoxNode
- type Input
- type List
- func (m *List) Add(item interface{})
- func (m *List) AddItem(item Viewer)
- func (m *List) Clear()
- func (m *List) CurrentItem() Viewer
- func (m *List) Init() tea.Cmd
- func (m *List) SetSelectedFunc(f func(tea.Msg) tea.Cmd)
- func (m *List) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *List) View() string
- type MessageStateChange
- type UpdateFunc
- type Viewer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeState ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) SetDelegate ¶
func (a *App) SetDelegate(f UpdateFunc)
SetDelegate sets the message handler to be run before messages are passed to the focused model. This function can be used for managing your own key bindings and state handling.
If the function returns a nil tea.Cmd, then will continue and pass the message through to the currently focused model.
func (*App) SetFocus ¶
SetFocus sets the model which will become focused and receive messages this method updates the application directly, if you would like to change focus via the MessageStateChange tea.Msg, you may use the ChangeState tea.Cmd
func (*App) SetInit ¶
SetInit sets the function to be called on initialization if no model is in focus
func (*App) Update ¶
Update handles tea.Msgs to perform updates to application model. Messages are inspected and handled in the following manner.
1. If the msg is an exit key press (crtl-c) boba exits by invoking tea.Quit 2. If the msg is a boba.MessageStateChange, then the application's focus is changed to the reference model and no tea.Cmd is returned 3. The message is then passed to the user defined delegate function to perform custom message handling, and returns the resulting tea.Cmd if not nil 4. Otherwise, the message is passed onto the currently focused model
type Box ¶ added in v0.0.3
type Box struct { // Percentage of Window height SizeX float64 // Percentage of Window width SizeY float64 // contains filtered or unexported fields }
func (*Box) AddNode ¶ added in v0.0.3
AddNode adds a new node with h and w percent of parent height and width
func (*Box) AddNodeWithStyle ¶ added in v0.0.3
type BoxNode ¶ added in v0.0.3
type Input ¶
Input is a wrapper around the bubbles textinput component It exposes the ability to define a function tio be called on input submission
func (*Input) SetSubmitHandler ¶
SetSubmitHandler sets the function to be called when the user input is submitted with Enter
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a model that displays a list of items that can be navigated and selected. The only requirement for list items are that they satisfy the Viewer interface
func (*List) Add ¶
func (m *List) Add(item interface{})
Add adds a generic item to the list which will be rendered with fmt.Sprint
func (*List) CurrentItem ¶
CurrentItem returns the item at the location of the cursor
func (*List) SetSelectedFunc ¶
SetSelectedFunc sets the function to be called when an item is selected. It receives the selected item as a tea.Msg and must return a tea.Cmd
type MessageStateChange ¶
type MessageStateChange struct {
// contains filtered or unexported fields
}