diff options
| -rw-r--r-- | TODOs.md | 2 | ||||
| -rwxr-xr-x | aux/assert-todos.sh | 49 |
2 files changed, 50 insertions, 1 deletions
@@ -1,6 +1,6 @@ # Tasks -## TODO Support tags in tasks? {#task-18eb3dfe-c667-4d18-967c-d406a28e94be} +## DONE Support tags in tasks? {#task-18eb3dfe-c667-4d18-967c-d406a28e94be} - DONE in 2021-02-20 Done in diff --git a/aux/assert-todos.sh b/aux/assert-todos.sh index 0430f378..5827e340 100755 --- a/aux/assert-todos.sh +++ b/aux/assert-todos.sh @@ -7,3 +7,52 @@ if git grep FIXME | grep -Ev "$EXCLUDE"; then echo "You should write them down properly on TODOs.org." exit 1 fi + +awk -F'{#' ' +BEGIN { + exitstatus = 0 + h2flag = 0 + h2status = "" + prevline = "" + idx = 0 + delete ids[0] +} +h2flag == 1 { + split($0, l, " ") + timelinestatus = l[2] + if (h2status != timelinestatus) { + print "h2/timeline status mismatch for line " NR-1 + print prevline + print $0 + exitstatus = 1 + } + h2status = "" + h2flag = 0 +} + +/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE)/ { + if (match($0, / \{#.*?\}$/) == 0) { + print "Missing ID for line " NR ":\n" $0 + exitstatus = 1 + } + id_with_prefix = substr($2, 0, length($2) - 1) + match(id_with_prefix, /^\w+-/) + id = substr(id_with_prefix, RLENGTH + 1) + if (id in arr) { + print "Duplicate ID: " id + exitstatus = 1 + } else { + arr[id] = 1 + } + + split($0, l, " ") + h2status = l[2] + h2flag = 1 + prevline = $0 +} + + +/^# Scratch$/ { + exit exitstatus +} +' TODOs.md |
