to4iki / Todotxt

todo.txt parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Todotxt

CI Swift 5 MIT License

parser of todo.txt format

https://github.com/todotxt/todo.txt

Usage

build Todo object

let input = "x (A) title +project @context due:2022-09-25"
let todo = TodoBuilder.build(input: input)

Sorted

sort TodoList in order of TodoList.SortType

extension TodoList {
  public enum SortType {
    case dueDate
    case priority
    case project
    case context
  }
}

let inputs = """
  x (A) title_1 +project @context due:2022-09-25
  (C) title_2 due:2022-09-26
  (B) title_3 +project due:2022-09-27
  (C) title_4 @context due:2022-09-28
  (A) title_5 due:2022-09-29
""".components(separatedBy: "\n")

let todoList = TodoBuilder.build(inputs: inputs)
todoList.sorted(by: .priority).compactMap(\.title)
// title_1, title_5, title_3, title_2, title_4

License

Todotxt is released under the MIT license.

About

todo.txt parser

License:MIT License


Languages

Language:Swift 96.7%Language:Makefile 3.3%