Skip to content

Commit c6c2134

Browse files
committed
Parse obsolete tasks
1 parent 8715c3f commit c6c2134

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/plan/parser.janet

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@
5050
:task-begin
5151
{:main (* "- " :checkbox)
5252
:checkbox
53-
{:main (+ :checkbox-done :checkbox-pending)
53+
{:main (+ :checkbox-done :checkbox-pending :checkbox-obsolete)
5454
:checkbox-done (* (+ "[x]" "[X]") (constant :checked))
55-
:checkbox-pending (* "[ ]" (constant :open))}}
55+
:checkbox-pending (* "[ ]" (constant :open))
56+
:checkbox-obsolete(* "[~]" (constant :obsolete))}}
5657
:task-missed-on-date (* " (missed on " (constant :missed-on) :date ")")
5758
:task-body
5859
{:main (group (any :task-body-line))

src/task.janet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
(import ./date)
55

6-
(def states [:open :checked])
6+
(def states [:open :checked :obsolete])
77

88
(defn build-task [title state &opt body]
99
(default body @[])

test/plan/parser_test.janet

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
## 2020-07-31, Friday
2626
2727
- Talked to Mike & Molly
28-
- [x] #work - Review open pull requests
28+
- [X] #work - Review open pull requests
29+
- [~] #work - Review logs
2930
- [x] #work - Fix the flaky test
3031
```)
3132
(def parse-result (parse plan-string))
@@ -59,6 +60,9 @@
5960
(test (task :title) "#work - Review open pull requests")
6061
(test (task :state) :checked))
6162
(let [task ((day-2 :tasks) 1)]
63+
(test (task :title) "#work - Review logs")
64+
(test (task :state) :obsolete))
65+
(let [task ((day-2 :tasks) 2)]
6266
(test (task :title) "#work - Fix the flaky test")
6367
(test (task :state) :checked)))
6468

0 commit comments

Comments
 (0)