tui

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	Quit:        key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "exit")),
	Search:      key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "search")),
	ToggleHelp:  key.NewBinding(key.WithKeys("?"), key.WithHelp("?", "help")),
	MoveUp:      key.NewBinding(key.WithKeys("j"), key.WithHelp("j", "move down")),
	MoveDown:    key.NewBinding(key.WithKeys("k"), key.WithHelp("k", "move up")),
	NextTab:     key.NewBinding(key.WithKeys("tab", "right"), key.WithHelp("tab", "navigate")),
	PreviousTab: key.NewBinding(key.WithKeys("shift+tab", "left"), key.WithHelp("shift+tab", "navigate")),
	Copy:        key.NewBinding(key.WithKeys("c"), key.WithHelp("c", "copy url")),
	GoToEnd:     key.NewBinding(key.WithKeys("end", "G"), key.WithHelp("G/end", "go to end")),
	GoToStart:   key.NewBinding(key.WithKeys("home", "g"), key.WithHelp("g/home", "go to start")),
}

DefaultKeyMap is the default key map for the application.

Functions

func NewLanguageList

func NewLanguageList() list.Model

func NewNewsList

func NewNewsList() list.Model

func StartTea

func StartTea()

StartTea the entry point for the UI. Initializes the model.

Types

type KeyMap

type KeyMap struct {
	Quit        key.Binding
	Search      key.Binding
	ToggleHelp  key.Binding
	MoveUp      key.Binding
	MoveDown    key.Binding
	GoToEnd     key.Binding
	GoToStart   key.Binding
	NextTab     key.Binding
	PreviousTab key.Binding
	Copy        key.Binding
}

KeyMap is the mappings of actions to key bindings.

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns all help options in a more detailed view.

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns a quick help menu.

type Model

type Model struct {
	// contains filtered or unexported fields
}

func NewModel

func NewModel() Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) NextTab

func (m *Model) NextTab()

func (*Model) PreviousTab

func (m *Model) PreviousTab()

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type News

type News struct {
	Title string
	Url   string
}

func (News) FilterValue

func (n News) FilterValue() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL