todo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTaskNotFound is returned when a task is not found
	ErrTaskNotFound = errors.New("task not found")

	// ErrVersionNotFound is returned when a version is not found
	ErrVersionNotFound = errors.New("version not found")

	// ErrVersionExists is returned when a version already exists
	ErrVersionExists = errors.New("version already exists")
)

Functions

This section is empty.

Types

type Service

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

Service provides todo operations

func NewService

func NewService(cfg *config.Config) *Service

NewService creates a new todo service

func (*Service) AddTask

func (s *Service) AddTask(version string, description string, parentID string) (string, error)

AddTask adds a new task to TODO.md

func (*Service) AddVersion

func (s *Service) AddVersion(version string) error

AddVersion adds a new version section to TODO.md

func (*Service) GetAll

func (s *Service) GetAll() (*TodoList, error)

GetAll retrieves all tasks from TODO.md

func (*Service) GetByVersion

func (s *Service) GetByVersion(version string) (*VersionTasks, error)

GetByVersion retrieves tasks for a specific version

func (*Service) UpdateTask

func (s *Service) UpdateTask(taskID string, completed *bool, description *string) error

UpdateTask updates an existing task

type Task

type Task struct {
	ID          string  `json:"id"`
	Description string  `json:"description"`
	Completed   bool    `json:"completed"`
	Version     string  `json:"version"`
	LineNumber  int     `json:"line_number"`
	Indent      int     `json:"indent"`
	SubTasks    []*Task `json:"subtasks,omitempty"`
}

Task represents a todo task

type TodoList

type TodoList struct {
	Versions []*VersionTasks `json:"versions"`
}

TodoList represents the entire TODO.md file

type VersionTasks

type VersionTasks struct {
	Version string  `json:"version"`
	Tasks   []*Task `json:"tasks"`
}

VersionTasks represents tasks grouped by version

Jump to

Keyboard shortcuts

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