tui

package
v0.0.0-...-d4fd6b2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartTUI

func StartTUI(c *client.Client) (err error)

StartTUI launches the TUI application. It checks whether the output is a terminal and returns an error if not.

func StartTUIReview

func StartTUIReview(c *client.Client, deck string, limit int, preview bool) error

StartTUIReview launches the TUI directly into review mode for the given deck.

func StartTUIWithBrowse

func StartTUIWithBrowse(c *client.Client) error

StartTUIWithBrowse launches the TUI directly into browse/note list mode.

func StartTUIWithDeck

func StartTUIWithDeck(c *client.Client, deck string) error

StartTUIWithDeck launches the TUI directly into review mode for the given deck.

Types

type AnswerResultMsg

type AnswerResultMsg struct {
	CardID int64
	Ease   int
	Err    error
}

AnswerResultMsg is sent after answering a card.

type CardsBrowseLoadedMsg

type CardsBrowseLoadedMsg struct {
	Cards []client.Card
	Query string
}

CardsBrowseLoadedMsg is sent when cards for browse view have been fetched.

type CardsLoadedMsg

type CardsLoadedMsg struct {
	Cards []client.Card
}

CardsLoadedMsg is sent when card data has been fetched.

type DecksLoadedMsg

type DecksLoadedMsg struct {
	Names []string
	Due   map[string]int
}

DecksLoadedMsg is sent when deck list has been fetched.

type ErrorMsg

type ErrorMsg struct {
	Err error
}

ErrorMsg wraps an error for display.

type FlagSetMsg

type FlagSetMsg struct {
	CardID int64
	Flag   int
}

FlagSetMsg is sent after a card flag is set.

type Model

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

Model is the main TUI model that manages state and delegates to sub-models.

func NewModel

func NewModel(c *client.Client) Model

NewModel creates a new TUI model with the given API client.

func (Model) Init

func (m Model) Init() tea.Cmd

Init returns the initial command.

func (Model) Update

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

Update handles all messages and delegates to the appropriate sub-view handler.

func (Model) View

func (m Model) View() string

View renders the current view.

type NoteCardsLoadedMsg

type NoteCardsLoadedMsg struct {
	Cards []client.Card
}

NoteCardsLoadedMsg is sent when cards for a note have been fetched.

type NoteDeletedMsg

type NoteDeletedMsg struct {
	Err error
}

NoteDeletedMsg is sent after a note is deleted.

type NoteDetailMsg

type NoteDetailMsg struct {
	Note client.Note
}

NoteDetailMsg is sent when a single note's full info has been fetched.

type NoteUpdatedMsg

type NoteUpdatedMsg struct {
	Err error
}

NoteUpdatedMsg is sent after a note's fields are updated.

type NotesLoadedMsg

type NotesLoadedMsg struct {
	Notes []client.Note
	Query string
}

NotesLoadedMsg is sent when note data has been fetched.

type UndoMsg

type UndoMsg struct {
	Err error
}

UndoMsg is sent after an undo API call completes.

type ViewChangeMsg

type ViewChangeMsg struct {
	View   ViewType
	Deck   string
	NoteID int64
}

ViewChangeMsg is sent to switch between views.

type ViewType

type ViewType int

ViewType represents the current active view in the TUI.

const (
	DeckListView ViewType = iota
	ReviewView
	SummaryView
	NoteListView
	NoteDetailView
	CardListView
)

Jump to

Keyboard shortcuts

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