Documentation
¶
Overview ¶
Package todo implements parsing, serialisation, and file I/O for the todo.txt format (https://github.com/todotxt/todo.txt).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLine ¶
AppendLine appends a new line to rawLines.
func DeleteLine ¶
DeleteLine removes the line at 1-based lineNumber from rawLines.
func UpdateLine ¶
UpdateLine replaces line at 1-based lineNumber with newLine in rawLines.
Types ¶
type Todo ¶
type Todo struct {
// LineNumber is the 1-based line number in todo.txt (insert order).
LineNumber int
Done bool
CompletedAt string // YYYY-MM-DD, only when Done == true
Priority string // single uppercase letter, empty if none
CreatedAt string // YYYY-MM-DD, empty if not set
Description string // raw description text (includes +projects @contexts key:val tags)
RawLine string // original unparsed line (used as fallback)
ParseFailed bool // true if the line could not be parsed normally
}
Todo represents a single parsed todo.txt task.
func ReadFile ¶
ReadFile reads all lines from path. If the file does not exist it returns an empty slice without error.
func (*Todo) Complete ¶
func (t *Todo) Complete()
Complete marks the todo as done today, stripping priority and saving it as a pri:X tag in the description.
func (*Todo) SavedPriority ¶
SavedPriority returns the value of the pri: tag (used to round-trip priority through completion), or empty string.
func (*Todo) Uncomplete ¶
func (t *Todo) Uncomplete()
Uncomplete reverses a completion, restoring the pri: tag to the priority field if present.