task

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package task defines the Task type and related styles, key bindings, and messages used to represent and render tasks in the list view.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteMsg

type DeleteMsg struct{}

DeleteMsg signals that the user requested deletion of the currently selected task.

type EnterEditMsg

type EnterEditMsg struct{}

EnterEditMsg signals that the user wants to edit the currently selected task in the list.

type Styles

type Styles struct {
	// The Normal state.
	Normal subStyle

	// The selected item state.
	Selected subStyle

	// The dimmed state, for when the filter input is initially activated.
	Dimmed subStyle

	// Characters matching the current filter, if any.
	FilterMatch lipgloss.Style

	// StatusMessage styles status text shown for task operations.
	StatusMessage lipgloss.Style
}

Styles contains all styles used to render tasks in the list, including normal, selected, dimmed, and filter match highlighting.

type Task

type Task struct {
	TitleStr string
	DescStr  string
	DueDate  time.Time
	Done     bool
	// contains filtered or unexported fields
}

Task represents a single task, including ID, title, description, due date, and completion status.

func New

func New() Task

New constructs a new, empty Task with a generated ID.

func NewWithOptions

func NewWithOptions(title, desc string, duedate time.Time, done bool) Task

NewWithOptions constructs a Task with the provided values and a generated ID.

func (Task) Description

func (t Task) Description() string

Description returns the task description.

func (Task) FilterValue

func (t Task) FilterValue() string

FilterValue implements list.Item and is used by the list filter.

func (Task) GetID

func (t Task) GetID() uuid.UUID

GetID returns the task's unique identifier.

func (Task) IsEmpty

func (t Task) IsEmpty() bool

IsEmpty reports whether the task has no title, description, due date, and is not marked as done.

func (*Task) SetID

func (t *Task) SetID(id uuid.UUID)

SetID sets the task's unique identifier.

func (Task) Title

func (t Task) Title() string

Title returns the task title.

type TaskDelegate

type TaskDelegate struct {
	Styles Styles
	// contains filtered or unexported fields
}

TaskDelegate implements list.ItemDelegate for Task items, handling rendering and key bindings for actions on tasks in the list.

func NewTaskDelegate

func NewTaskDelegate() TaskDelegate

NewTaskDelegate constructs a TaskDelegate with default styles and keymap.

func (TaskDelegate) FullHelp

func (t TaskDelegate) FullHelp() [][]key.Binding

FullHelp implements the help.KeyMap interface for the full help view of task-related key bindings.

func (TaskDelegate) Height

func (t TaskDelegate) Height() int

Height returns the number of lines used to render each task.

func (TaskDelegate) Render

func (t TaskDelegate) Render(w io.Writer, m list.Model, index int, item list.Item)

Render draws a Task into the list, applying styles for selection, filtering, and completion state.

func (TaskDelegate) ShortHelp

func (t TaskDelegate) ShortHelp() []key.Binding

ShortHelp implements the help.KeyMap interface for condensed help for task-related key bindings.

func (TaskDelegate) Spacing

func (t TaskDelegate) Spacing() int

Spacing returns the number of blank lines between rendered tasks.

func (TaskDelegate) Update

func (t TaskDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd

Update handles key events for the list delegate

type TaskKeyMap

type TaskKeyMap struct {
	EditItem   key.Binding
	ToggleDone key.Binding
	RemoveItem key.Binding
}

TaskKeyMap defines key bindings for actions on a single task in the list, such as editing, toggling completion, and removing.

func (TaskKeyMap) FullHelp

func (t TaskKeyMap) FullHelp() [][]key.Binding

FullHelp implements the help.KeyMap interface for the full help view for task-related key bindings.

func (TaskKeyMap) ShortHelp

func (t TaskKeyMap) ShortHelp() []key.Binding

ShortHelp implements the help.KeyMap interface for condensed help.

type ToggleDoneMsg

type ToggleDoneMsg struct{}

ToggleDoneMsg signals that the user toggled the completion state of the currently selected task.

Directories

Path Synopsis
Package editmenu provides a Bubble Tea sub-model for creating and editing tasks, including a form, validation, and contextual help.
Package editmenu provides a Bubble Tea sub-model for creating and editing tasks, including a form, validation, and contextual help.

Jump to

Keyboard shortcuts

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