Documentation
¶
Overview ¶
Package todo manages a list of tasks with status tracking.
Index ¶
- Variables
- type List
- func (l *List) Add(todo Todo)
- func (l *List) AllCompleted() bool
- func (l *List) ByStatus(status Status) []int
- func (l *List) Complete(index int) error
- func (l *List) Counts() (pending, inProgress, completed int)
- func (l *List) FindInProgress() []int
- func (l *List) FindPending() []int
- func (l *List) Get() []Todo
- func (l *List) IsEmpty() bool
- func (l *List) Len() int
- func (l *List) MarkStatus(index int, status Status) error
- func (l *List) Remove(index int) error
- func (l *List) Replace(todos []Todo)
- func (l *List) SetSummary(summary string)
- func (l *List) String() string
- type Status
- type Todo
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidIndex = errors.New("invalid todo index")
ErrInvalidIndex is returned when an operation targets an out-of-range index.
Functions ¶
This section is empty.
Types ¶
type List ¶
List holds an ordered collection of todos and an optional summary.
func Parse ¶
Parse parses a text representation of a todo list (as produced by String) back into a List. Unrecognized lines are silently ignored. Returns an error only if a matched todo line contains an invalid status.
func (*List) AllCompleted ¶
AllCompleted reports whether all items are completed, or the list is empty.
func (*List) FindInProgress ¶
FindInProgress returns the indices of all in-progress todos.
func (*List) FindPending ¶
FindPending returns the indices of all pending todos.
func (*List) MarkStatus ¶
MarkStatus updates the status of the todo at the given index.
func (*List) SetSummary ¶
SetSummary updates the executive summary.