Documentation
¶
Overview ¶
Package tui provides a terminal user interface for Thicket.
Index ¶
- func DetailFullHelp() []helpSection
- func DetailHelp() string
- func FormFullHelp() []helpSection
- func FormHelp() string
- func HelpContentHeight(sections []helpSection) int
- func ListFullHelp() []helpSection
- func ListHelp() string
- func RenderHelp(sections []helpSection, width, height int) string
- func RenderHelpWithScroll(sections []helpSection, width, height, scrollY int) string
- func Run(store *storage.Store, cfg *config.Config, ticketsPath string) error
- func WatchFile(path string, debounce time.Duration) func() (chan FileChangedMsg, func())
- type AddCommentMsg
- type BackToListMsg
- type CommentSavedMsg
- type CreateTicketMsg
- type DetailModel
- type EditTicketMsg
- type ErrorMsg
- type FileChangedMsg
- type FilterState
- type FormModel
- type HelpModel
- type KeyMap
- type ListModel
- type Model
- type PromptModel
- type PromptResult
- type RefreshListMsg
- type SelectorModel
- type StatusMsg
- type TicketClosedMsg
- type TicketLoadedMsg
- type TicketPriorityUpdatedMsg
- type TicketSavedMsg
- type TicketTypeUpdatedMsg
- type TicketsLoadedMsg
- type ViewTicketMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetailFullHelp ¶
func DetailFullHelp() []helpSection
DetailFullHelp returns the full help content for detail view.
func DetailHelp ¶
func DetailHelp() string
DetailHelp returns help text for detail view (abbreviated).
func FormFullHelp ¶
func FormFullHelp() []helpSection
FormFullHelp returns the full help content for form view.
func HelpContentHeight ¶
func HelpContentHeight(sections []helpSection) int
HelpContentHeight returns the total number of lines in the help content.
func ListFullHelp ¶
func ListFullHelp() []helpSection
ListFullHelp returns the full help content for list view.
func RenderHelp ¶
RenderHelp renders the help overlay for the given sections.
func RenderHelpWithScroll ¶
RenderHelpWithScroll renders the help overlay with scroll support.
func WatchFile ¶
func WatchFile(path string, debounce time.Duration) func() (chan FileChangedMsg, func())
WatchFile returns a command that watches the given file for changes. When the file changes, it sends a FileChangedMsg. The debounce parameter controls how long to wait after a change before sending the message (to avoid rapid repeated updates).
Types ¶
type AddCommentMsg ¶
type AddCommentMsg struct {
TicketID string
}
AddCommentMsg is sent when the user wants to add a comment.
type BackToListMsg ¶
type BackToListMsg struct{}
BackToListMsg is sent when the user wants to return to the list view.
type CommentSavedMsg ¶
type CommentSavedMsg struct {
TicketID string
}
CommentSavedMsg is sent after a comment has been saved.
type CreateTicketMsg ¶
type CreateTicketMsg struct{}
CreateTicketMsg is sent when the user wants to create a new ticket.
type DetailModel ¶
type DetailModel struct {
// contains filtered or unexported fields
}
DetailModel handles the ticket detail view.
func NewDetailModel ¶
func NewDetailModel(store *storage.Store) DetailModel
NewDetailModel creates a new detail model.
func (DetailModel) LoadTicket ¶
func (m DetailModel) LoadTicket() tea.Cmd
LoadTicket loads the ticket details.
func (*DetailModel) SetSearchQuery ¶
func (m *DetailModel) SetSearchQuery(query string)
SetSearchQuery sets the query to highlight.
func (*DetailModel) SetSize ¶
func (m *DetailModel) SetSize(width, height int)
SetSize sets the dimensions for the detail view.
func (*DetailModel) SetTicketID ¶
func (m *DetailModel) SetTicketID(id string)
SetTicketID sets the ticket to display.
func (DetailModel) Update ¶
func (m DetailModel) Update(msg tea.Msg) (DetailModel, tea.Cmd)
Update handles messages for the detail view.
type EditTicketMsg ¶
EditTicketMsg is sent when the user wants to edit a ticket.
type FileChangedMsg ¶
type FileChangedMsg struct{}
FileChangedMsg is sent when the ticket database file changes.
type FilterState ¶
FilterState holds the current filter settings.
type FormModel ¶
type FormModel struct {
// contains filtered or unexported fields
}
FormModel handles the create/edit ticket form.
func NewFormModel ¶
NewFormModel creates a new form model.
type HelpModel ¶
type HelpModel struct {
// contains filtered or unexported fields
}
HelpModel provides a help overlay for displaying keyboard shortcuts.
func (*HelpModel) ResetScroll ¶
func (h *HelpModel) ResetScroll()
ResetScroll resets the scroll position to the top.
func (*HelpModel) ScrollDown ¶
ScrollDown scrolls the help content down by one line.
func (*HelpModel) ScrollUp ¶
func (h *HelpModel) ScrollUp()
ScrollUp scrolls the help content up by one line.
type KeyMap ¶
type KeyMap struct {
// Global keys
Quit key.Binding
Help key.Binding
// Navigation
Up key.Binding
Down key.Binding
Top key.Binding
Bottom key.Binding
// Actions
Enter key.Binding
Back key.Binding
New key.Binding
Edit key.Binding
Close key.Binding
Comment key.Binding
Search key.Binding
Refresh key.Binding
PriorityUp key.Binding
PriorityDown key.Binding
// Filtering
FilterOpen key.Binding
FilterClosed key.Binding
FilterIcebox key.Binding
FilterAll key.Binding
// Type settings
SetBug key.Binding
SetFeature key.Binding
SetTask key.Binding
SetEpic key.Binding
SetCleanup key.Binding
// Direct priority settings
SetPriority0 key.Binding
SetPriority1 key.Binding
SetPriority2 key.Binding
SetPriority3 key.Binding
SetPriority4 key.Binding
SetPriority5 key.Binding
// Form navigation
NextField key.Binding
PrevField key.Binding
Save key.Binding
Cancel key.Binding
}
KeyMap defines all key bindings for the TUI.
type ListModel ¶
type ListModel struct {
// contains filtered or unexported fields
}
ListModel handles the ticket list view.
func NewListModel ¶
NewListModel creates a new list model.
func (ListModel) IsSearching ¶
IsSearching returns true if search mode is active.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root model for the TUI application.
type PromptModel ¶
type PromptModel struct {
// contains filtered or unexported fields
}
PromptModel provides a reusable yes/no confirmation prompt. It captures keyboard input when active and invokes callbacks on confirm/cancel.
func (PromptModel) Active ¶
func (p PromptModel) Active() bool
Active returns whether the prompt is currently displayed.
func (PromptModel) Context ¶
func (p PromptModel) Context() string
Context returns the context data set when showing the prompt.
func (*PromptModel) Show ¶
func (p *PromptModel) Show(message string, context string)
Show activates the prompt with the given message. The context parameter can store additional data (e.g., ticket ID).
func (*PromptModel) Update ¶
func (p *PromptModel) Update(msg tea.Msg) PromptResult
Update handles keyboard input for the prompt. Returns the result of the user's action.
func (PromptModel) View ¶
func (p PromptModel) View() string
View renders the prompt if active. Returns an empty string if the prompt is not active.
type PromptResult ¶
type PromptResult int
PromptResult represents the user's response to a prompt.
const ( PromptPending PromptResult = iota PromptConfirmed PromptCancelled )
type RefreshListMsg ¶
type RefreshListMsg struct{}
RefreshListMsg is sent to refresh the ticket list.
type SelectorModel ¶
type SelectorModel struct {
// contains filtered or unexported fields
}
SelectorModel provides a selection list for choosing from predefined options. Users cycle through options with left/right arrow keys when focused.
func NewSelector ¶
func NewSelector(options []string) SelectorModel
NewSelector creates a new selector with the given options. The first option is selected by default.
func (SelectorModel) Focused ¶
func (s SelectorModel) Focused() bool
Focused returns whether the selector is focused.
func (*SelectorModel) SetValue ¶
func (s *SelectorModel) SetValue(value string)
SetValue sets the selection to the option matching the given value. If the value is not found, the selection is unchanged.
func (SelectorModel) Update ¶
func (s SelectorModel) Update(msg tea.Msg) (SelectorModel, tea.Cmd)
Update handles keyboard input for the selector.
func (SelectorModel) Value ¶
func (s SelectorModel) Value() string
Value returns the currently selected option.
func (SelectorModel) View ¶
func (s SelectorModel) View() string
View renders the selector. Shows all options with the selected one highlighted.
type TicketClosedMsg ¶
type TicketClosedMsg struct {
ID string
}
TicketClosedMsg is sent after a ticket has been closed.
type TicketLoadedMsg ¶
type TicketLoadedMsg struct {
Ticket *ticket.Ticket
Comments []*ticket.Comment
BlockedBy []*ticket.Ticket
Blocking []*ticket.Ticket
Err error
}
TicketLoadedMsg is sent when a single ticket's details have been loaded.
type TicketPriorityUpdatedMsg ¶
TicketPriorityUpdatedMsg is sent after a ticket's priority has been updated.
type TicketSavedMsg ¶
TicketSavedMsg is sent after a ticket has been saved.
type TicketTypeUpdatedMsg ¶
TicketTypeUpdatedMsg is sent after a ticket's type has been updated.
type TicketsLoadedMsg ¶
TicketsLoadedMsg is sent when tickets have been loaded from storage.
type ViewTicketMsg ¶
type ViewTicketMsg struct {
ID string
}
ViewTicketMsg is sent when the user wants to view a ticket's details.