Documentation
¶
Index ¶
- Variables
- func GeneralOverlayStyle(overlayWidth int) lipgloss.Style
- func IsKeyMatch(msg tea.KeyMsg, keyBinding string) bool
- func RenderHelpOverlay(m *Model) string
- func RenderTaskDetailOverlay(width, height int, selectedTask *task.Task) string
- func RenderTaskPicker(width, height int, input string, matches []task.Task, selectedIndex int) string
- func TaskDetailOverlayStyle(overlayWidth, overlayHeight int) lipgloss.Style
- func TaskPickerInputStyle(overlayWidth int) lipgloss.Style
- func TaskPickerMatchStyle(overlayWidth int) lipgloss.Style
- func TaskPickerSelectedMatchStyle(overlayWidth int) lipgloss.Style
- func TextWrap(s string, n int) []string
- type Context
- type Control
- type KeyBinding
- type KeyBindingSection
- type KeyBindings
- func (kb KeyBindings) GenerateHelpContent(overlayWidth int) string
- func (kb KeyBindings) GetKeyBindingsForContext(context Context) []KeyBinding
- func (kb KeyBindings) GetKeyBindingsForDetailsOverlay() []KeyBinding
- func (kb KeyBindings) GetKeyBindingsForGlobal() []KeyBinding
- func (kb KeyBindings) GetKeyBindingsForHelpOverlay() []KeyBinding
- func (kb KeyBindings) GetKeyBindingsForTaskPicker() []KeyBinding
- func (kb KeyBindings) RenderHelpView(taskRunning bool, showTaskPicker bool, hasSelectedTasks bool) string
- type Model
- func (m *Model) AppendAppMsg(msg string)
- func (m *Model) AppendCommandOutput(msg string)
- func (m *Model) AppendErrorMsg(msg string)
- func (m *Model) AppendToViewport(msg string, style lipgloss.Style)
- func (m *Model) ExecuteSelectedTask() tea.Cmd
- func (m *Model) HandleWindowResize(width, height int)
- func (m Model) Init() tea.Cmd
- func (m *Model) RefreshTaskList() tea.Cmd
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) UpdateTaskTable()
- func (m Model) View() string
- type TickMessage
- type UIState
Constants ¶
This section is empty.
Variables ¶
var ( TableStyle = lipgloss.NewStyle().BorderStyle(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color("240")) TableHeaderStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("69")) TableSelectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("229")).Bold(true) TableSelectedTaskStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("39")).Bold(true).PaddingLeft(1) )
Table Styles
var ( ViewportStyle = lipgloss.NewStyle().BorderStyle(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color("240")) FocusedStyle = lipgloss.NewStyle().BorderStyle(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color("69")) HelpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")) // Message Styles AppMsgStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("10")).Bold(true) // Green for app messages ErrorMsgStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Bold(true) // Red for error messages OutputStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("7")) // Default color for regular output )
var ( TaskDetailOverlayTitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("63")). MarginBottom(1) TaskDetailOverlayLabelStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("241")) )
Task Detail Overlay styles
var ( HelpTextTitleStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("63")).MarginBottom(1) HelpTextSectionStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("69")).MarginTop(1).MarginBottom(1) HelpTextCommandStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("241")) )
Help Text styles
var ( TaskPickerTitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("63")). MarginBottom(1) )
Task Picker styles
Functions ¶
func GeneralOverlayStyle ¶ added in v0.3.0
func IsKeyMatch ¶ added in v0.3.1
IsKeyMatch checks if a key message matches a key binding
func RenderHelpOverlay ¶ added in v0.3.0
RenderHelpOverlay renders an overlay with all available commands
func RenderTaskDetailOverlay ¶
RenderTaskDetailOverlay renders an overlay with detailed task information
func RenderTaskPicker ¶ added in v0.3.0
func RenderTaskPicker(width, height int, input string, matches []task.Task, selectedIndex int) string
RenderTaskPicker renders the task picker overlay
func TaskDetailOverlayStyle ¶ added in v0.3.0
func TaskPickerInputStyle ¶ added in v0.3.0
func TaskPickerMatchStyle ¶ added in v0.3.0
func TaskPickerSelectedMatchStyle ¶ added in v0.3.0
Types ¶
type Context ¶ added in v0.3.1
type Context string
Context is a type alias for string representing UI contexts where key bindings are active
type KeyBinding ¶ added in v0.3.1
type KeyBinding struct { Key string // The key or key combination (e.g., "ctrl+c", "enter") Description string // Description of what the key does Contexts []Context // Contexts where this key binding is active }
KeyBinding represents a single key binding with its key, description, and context
type KeyBindingSection ¶ added in v0.3.1
type KeyBindingSection struct { Name string // Section name (e.g., "Navigation", "Task Management") KeyBindings []KeyBinding // Key bindings in this section }
KeyBindingSection represents a section of key bindings in the help text
type KeyBindings ¶ added in v0.3.1
type KeyBindings struct {
Sections []KeyBindingSection // Sections of key bindings
}
KeyBindings contains all key bindings used in the application
func DefaultKeyBindings ¶ added in v0.3.1
func DefaultKeyBindings() KeyBindings
DefaultKeyBindings returns the default key bindings for the application
func (KeyBindings) GenerateHelpContent ¶ added in v0.3.1
func (kb KeyBindings) GenerateHelpContent(overlayWidth int) string
GenerateHelpContent creates the help content with a two-column layout using the key bindings
func (KeyBindings) GetKeyBindingsForContext ¶ added in v0.3.1
func (kb KeyBindings) GetKeyBindingsForContext(context Context) []KeyBinding
GetKeyBindingsForContext returns all key bindings for a specific context
func (KeyBindings) GetKeyBindingsForDetailsOverlay ¶ added in v0.3.1
func (kb KeyBindings) GetKeyBindingsForDetailsOverlay() []KeyBinding
GetKeyBindingsForDetailsOverlay returns key bindings for the details overlay
func (KeyBindings) GetKeyBindingsForGlobal ¶ added in v0.3.1
func (kb KeyBindings) GetKeyBindingsForGlobal() []KeyBinding
GetKeyBindingsForGlobal returns key bindings for the global context
func (KeyBindings) GetKeyBindingsForHelpOverlay ¶ added in v0.3.1
func (kb KeyBindings) GetKeyBindingsForHelpOverlay() []KeyBinding
GetKeyBindingsForHelpOverlay returns key bindings for the help overlay
func (KeyBindings) GetKeyBindingsForTaskPicker ¶ added in v0.3.1
func (kb KeyBindings) GetKeyBindingsForTaskPicker() []KeyBinding
GetKeyBindingsForTaskPicker returns key bindings specific to the task picker
func (KeyBindings) RenderHelpView ¶ added in v0.3.1
func (kb KeyBindings) RenderHelpView(taskRunning bool, showTaskPicker bool, hasSelectedTasks bool) string
RenderHelpView renders the help text at the bottom of the screen using the key bindings
type Model ¶
type Model struct { MessageBus msgbus.PublisherSubscriber[task.Message] `json:"-"` Tasks []task.Task `json:"-"` TasksLoading bool Result *string `json:"-"` Viewport viewport.Model `json:"-"` Table table.Model `json:"-"` Focused Control Width int Height int Initialised bool SelectedTask *task.Task State UIState // Current UI state (normal, task picker, details overlay, help overlay) HelpViewport viewport.Model `json:"-"` // Viewport for scrollable help content Command *exec.Cmd `json:"-"` CommandCancel context.CancelFunc TaskRunning bool KeyBindings KeyBindings `json:"-"` // Key bindings for the application // Task picker fields TaskPickerInput string TaskPickerMatches []task.Task `json:"-"` TaskPickerSelected int // Selected tasks for batch execution SelectedTasks []task.Task ExecutingBatch bool CurrentBatchTaskIndex int // contains filtered or unexported fields }
Model represents the UI model for the application
func NewModel ¶
func NewModel(bus msgbus.PublisherSubscriber[task.Message]) Model
NewModel creates a new UI model
func (*Model) AppendAppMsg ¶
AppendAppMsg adds an application message to the viewport
func (*Model) AppendCommandOutput ¶
AppendCommandOutput adds command output to the viewport
func (*Model) AppendErrorMsg ¶
AppendErrorMsg adds an error message to the viewport
func (*Model) AppendToViewport ¶
AppendToViewport adds text to the viewport
func (*Model) ExecuteSelectedTask ¶
ExecuteSelectedTask executes the selected task
func (*Model) HandleWindowResize ¶
HandleWindowResize handles window resize events
func (*Model) RefreshTaskList ¶
RefreshTaskList refreshes the task list
func (*Model) UpdateTaskTable ¶
func (m *Model) UpdateTaskTable()
UpdateTaskTable updates the task table with the current tasks
type TickMessage ¶ added in v0.5.0
type TickMessage struct{}
type UIState ¶ added in v0.3.1
type UIState int
UIState represents the different states of the UI
const ( // StateNormal is the default state of the UI StateNormal UIState = iota // StateTaskPicker is the state when the task picker is active StateTaskPicker // StateDetailsOverlay is the state when the task details overlay is active StateDetailsOverlay // StateHelpOverlay is the state when the help overlay is active StateHelpOverlay )