TodoFiles.jl

TodoFiles.jl is a Julia package for reading and writing the Todo.txt format. It parses todo.txt files into structured Todo objects with direct access to priorities, dates, contexts (@tag), projects (+tag), and metadata (key:value pairs).

Installation

using Pkg
Pkg.add("TodoFiles")

Quickstart

using TodoFiles, Dates

# Parse a single task
t = parse_todo("(A) 2024-01-15 Call Mom @phone +Family due:2024-01-20")
Precompiling packages...
    974.9 msQuartoNotebookWorkerTablesExt (serial)
  1 dependency successfully precompiled in 1 seconds
Todo: (A) 2024-01-15 Call Mom @phone +Family due:2024-01-20
# Access fields directly
t.priority, t.contexts, t.projects, t.metadata
('A', ["phone"], ["Family"], Dict("due" => "2024-01-20"))
# Construct a Todo with keyword arguments -- tags are auto-extracted from the description
t2 = Todo("Buy groceries @store +Errands"; priority='B', creation_date=Date(2024, 1, 15))
Todo: (B) 2024-01-15 Buy groceries @store +Errands
# Roundtrip: write back to Todo.txt format
write_todo(t2)
"(B) 2024-01-15 Buy groceries @store +Errands"
# Parse and write multiple tasks
text = """
(A) Call Mom @phone
(B) 2024-01-15 Buy groceries @store +Errands
x 2024-01-16 2024-01-15 Pay bills
"""

todos = parse_todos(text)
3-element Vector{Todo}:
 Todo: (A) Call Mom @phone
 Todo: (B) 2024-01-15 Buy groceries @store +Errands
 Todo: x 2024-01-16 2024-01-15 Pay bills
print(write_todos(todos))
(A) Call Mom @phone
(B) 2024-01-15 Buy groceries @store +Errands
x 2024-01-16 2024-01-15 Pay bills