Skip to content

1set/todotxt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f72a2a5 · Oct 9, 2022

History

31 Commits
Nov 21, 2020
Nov 21, 2020
Nov 7, 2020
Nov 6, 2020
Nov 21, 2020
Nov 16, 2020
Nov 30, 2020
Nov 6, 2020
Nov 21, 2020
Nov 21, 2020
Oct 9, 2022
Nov 17, 2020
Nov 17, 2020
Nov 30, 2020
Nov 21, 2020
Nov 21, 2020
Nov 21, 2020
Oct 9, 2022
Nov 21, 2020
Nov 30, 2020
Oct 9, 2022
Nov 30, 2020
Nov 21, 2020

Repository files navigation

todotxt

Yet another a Go library for Gina Trapani's todo.txt files. ✅

PkgGoDev License GitHub Action Workflow Go Report Card Codacy Badge Codecov

Features

Based on go-todotxt from Fabio Berchtold with:

  • Go mod support
  • Segments for task string
  • Task due today is not overdue
  • Negative Due() for overdue tasks
  • Support multiple options for sorting and filtering
  • More sorting options: by ID, text, context, project
  • Preset filters

Usage

A quick start example:

import (
	todo "github.com/1set/todotxt"
)

// ...

if tasklist, err := todo.LoadFromPath("todo.txt"); err != nil {
    log.Fatal(err)
} else {
    tasks := tasklist.Filter(todo.FilterNotCompleted).Filter(todo.FilterDueToday, todo.FilterHasPriority)
    _ = tasks.Sort(todo.SortPriorityAsc, todo.SortProjectAsc)
    for i, t := range tasks {
        fmt.Println(t.Todo)
        // oh really?
        tasks[i].Complete()
    }
    if err = tasks.WriteToPath("today-todo.txt"); err != nil {
        log.Fatal(err)
    }
}

For more examples and details, please check the Go Doc.

Credits