Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUserQuit = errors.New("the user manually exited the view")
)
Canned errors for terminal interfaces.
Functions ¶
func List ¶
func List(list QueryableList, maxToDisplay int, vimNavigation bool) (interface{}, error)
List implements an interactive terminal list, printing the interface out to stderr and allowing the user to navigate and choose an option.
The Vim bindings are currently limited to just list navigation.
TODO: I really don't like returning an interface{} and then casting it back to the correct type later. Need to brainstorm better ways to keep this component generalizable while cleaning up the interface
Types ¶
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event represents a keyboard event. If the Key is KeyChar, the char field should be checked for the specific character that was pressed.
type FormattedChunk ¶
FormattedChunk defines a section of contiguous text.
type FormattedContent ¶
type FormattedContent struct { Content string Highlights []FormattedChunk }
FormattedContent is a set of text with certain parts marked for additional formatting. Content contains all text to be shown, with the Highlights slice specifying section that should be displayed differently.
type Key ¶
type Key int
Key represents keyboard keys.
Define various keys that are currently tracked by the application. These are mostly special keys/key combos. KeyChar represents an actual character. The definitions are split up into multiple blocks as only a few keys/key combos are currently tracked.
type ListItem ¶
type ListItem struct { DisplayFields []FormattedContent Raw interface{} }
ListItem represents an individual item in the list. It is made up of a list of content to display and an associated arbitrary piece of data that will be returned to the caller if the item is selected.
type QueryableList ¶
QueryableList abstracts a searchable corpus of data. The Search method will be repeatedly called as the query changes.
type Tty ¶
type Tty struct {
// contains filtered or unexported fields
}
Tty represents a raw terminal interface.
func NewTty ¶
NewTty creates a new Tty. It has a side-effect of switching the current terminal to raw mode.
func (*Tty) GetKeyboardEvent ¶
GetKeyboardEvent blocks until there is a keyboard event, and then returns it.