Documentation ¶
Overview ¶
Package tea provides an Elm inspired functional framework for interactive command-line programs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
Cmd is a function used to perform an action, when complete you may return a message, error, or nil.
For example a comand which removes a user from a database might return a struct UserRemoved with its ID so that Update() can remove it before rendering.
Errors are special cased, so you may return an error in place of a message, this will cause the program to exit and the error will be printed. If you wish to handle errors in a different way, you should return a message containing the error and update your model accordingly.
Returning nil is a no-op.
type Init ¶
Init is a function which is invoked when starting your program, returning the initial model and optional command.
type Model ¶
type Model interface{}
Model is the model which defines all or a subset of your program state.
type Msg ¶
type Msg interface{}
Msg is passed to your program's Update() function, representing an action which was performed, for example a ItemRemoved msg might be a struct containing the ID of the item removed.
type Program ¶
type Program struct { // Init function. Init // Update function. Update // View function. View // contains filtered or unexported fields }
Program is a terminal application comprised init, update, and view functions.
func NewProgram ¶
NewProgram returns a new program.
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package input provides a text input.
|
Package input provides a text input. |
Package option provides an option list with a single selectable value.
|
Package option provides an option list with a single selectable value. |
Package options provides an options list with many selectable values.
|
Package options provides an options list with many selectable values. |
Package progress provides a progress bar.
|
Package progress provides a progress bar. |
Package shortcut provides a shortcut keys.
|
Package shortcut provides a shortcut keys. |
Package spinner provides a frame-based textual spinner.
|
Package spinner provides a frame-based textual spinner. |
Package steps provides a wizard style step progress bar.
|
Package steps provides a wizard style step progress bar. |
Package viewport provides a scrollable view into content.
|
Package viewport provides a scrollable view into content. |