Files
todotxt2remind/main.go
Paolo Donadeo 9cfc9abc93 feat: initial parser for todo.txt format with spec and test cases
- Add parser for todo.txt tasks supporting priority, dates, projects,
  contexts, and key:value metadata
- Include full todo.txt format specification (SPECS.md) and visual
  description (description.svg)
- Add sample test.todo.txt file with valid, borderline, and malformed
  cases
- Initialize Go module and main entrypoint for parsing and JSON output
- Add .gitignore for binary artifacts
2025-11-24 23:30:45 +01:00

32 lines
592 B
Go

package main
import (
"encoding/json"
"fmt"
"os"
"git.donadeo.net/pdonadeo/todotxt2remind/internal/parser"
)
func main() {
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "usage: example /path/to/todo.txt\n")
os.Exit(2)
}
f, err := os.Open(os.Args[1])
if err != nil {
panic(err)
}
defer func() { _ = f.Close() }()
tasks, errors := parser.ParseReader(f)
if len(errors) > 0 {
fmt.Fprintf(os.Stderr, "errors while parsing:\n")
for _, e := range errors {
fmt.Fprintf(os.Stderr, " - %v\n", e)
}
}
b, _ := json.MarshalIndent(tasks, "", " ")
fmt.Println(string(b))
}