diff --git a/man/rem2ps.1.in b/man/rem2ps.1.in index adf7f1d7..6b8442ca 100644 --- a/man/rem2ps.1.in +++ b/man/rem2ps.1.in @@ -639,6 +639,10 @@ If the reminder is a TODO reminder, then \fIflag\fR will be the integer If the reminder has a COMPLETE-THROUGH date, then this key will be present and its value will be a string of the form YYYY-MM-DD. .TP +.B max_overdue \fIn\fR +If the reminder has a MAX-OVERDUE clause, then this key will be present and +its value will be the integer argument to MAX-OVERDUE. +.TP .B priority \fIn\fR The priority of the reminder. Always present; if no PRIORITY keyword is specified, then a reminder has a default priority of 5000. diff --git a/src/calendar.c b/src/calendar.c index 4c52b626..2242f4f3 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -2520,6 +2520,9 @@ void WriteJSONTrigger(Trigger const *t, int include_tags) PrintJSONKeyPairInt("scanfrom", t->scanfrom); } } + if (t->max_overdue >= 0) { + PrintJSONKeyPairInt("max_overdue", t->max_overdue); + } PrintJSONKeyPairDate("from", t->from); PrintJSONKeyPairInt("priority", t->priority); PrintJSONKeyPairDateTime("eventstart", t->eventstart); diff --git a/tests/test-rem b/tests/test-rem index fc25535d..f5362e02 100644 --- a/tests/test-rem +++ b/tests/test-rem @@ -769,7 +769,8 @@ echo "Testing TODOS in calendar mode" >> ../tests/test.out 2>&1 echo "" >> ../tests/test.out 2>&1 echo "Testing TODOS in calendar mode with completed todos hidden" >> ../tests/test.out 2>&1 ../src/remind -s --hide-completed-todos ../tests/todos.rem 2025-08-13 >> ../tests/test.out 2>&1 - +echo "Testing TODOS and JSON mode" >> ../tests/test.out 2>&1 +../src/remind --json ../tests/todos.rem 2025-08-13 >> ../tests/test.out 2>&1 cmp -s ../tests/test.out ../tests/test.cmp if [ "$?" = "0" ]; then echo "Remind: Acceptance test PASSED" diff --git a/tests/test.cmp b/tests/test.cmp index 8dfb0c20..07b9e978 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -39600,3 +39600,18 @@ Testing TODOS in calendar mode with completed todos hidden 2025/08/20 * * * * Ninth 2025/08/27 * * * * Eighth 2025/08/27 * * * * Ninth +Testing TODOS and JSON mode +[ +{"date":"2025-08-01","filename":"../tests/todos.rem","lineno":4,"d":1,"m":8,"y":2025,"is_todo":1,"trigbase":"2025-08-1 ","priority":5000,"body":"First on 2025-08-01"}, +{"date":"2022-08-01","filename":"../tests/todos.rem","lineno":5,"d":1,"m":8,"is_todo":1,"complete_through":"2022-07-31","priority":5000,"body":"Second on 2022-08-01"}, +{"date":"2023-08-01","filename":"../tests/todos.rem","lineno":6,"d":1,"m":8,"is_todo":1,"complete_through":"2022-08-01","priority":5000,"body":"Third on 2023-08-01"}, +{"date":"2025-08-20","filename":"../tests/todos.rem","lineno":7,"d":20,"m":8,"y":2025,"is_todo":1,"delta":7,"trigbase":"2025-08-20","priority":5000,"body":"Fourth on 2025-08-20"}, +{"date":"2025-08-13","filename":"../tests/todos.rem","lineno":8,"d":13,"m":8,"y":2025,"is_todo":1,"delta":7,"trigbase":"2025-08-13","priority":5000,"body":"Fifth today"}, +{"date":"2025-08-06","filename":"../tests/todos.rem","lineno":9,"d":6,"m":8,"y":2025,"is_todo":1,"delta":7,"trigbase":"2025-08-6 ","priority":5000,"body":"Sixth on 2025-08-06"}, +{"date":"2025-08-20","filename":"../tests/todos.rem","lineno":11,"wd":["Wednesday"],"is_todo":1,"complete_through":"2025-08-13","delta":7,"priority":5000,"body":"Eighth on 2025-08-20"}, +{"date":"2025-08-13","filename":"../tests/todos.rem","lineno":12,"wd":["Wednesday"],"is_todo":1,"complete_through":"2025-08-12","delta":7,"priority":5000,"body":"Ninth today"}, +{"date":"2025-08-13","filename":"../tests/todos.rem","lineno":15,"d":13,"m":8,"y":2025,"is_todo":1,"trigbase":"2025-08-13","max_overdue":3,"priority":5000,"body":"Yup today"}, +{"date":"2025-08-12","filename":"../tests/todos.rem","lineno":16,"d":12,"m":8,"y":2025,"is_todo":1,"trigbase":"2025-08-12","max_overdue":3,"priority":5000,"body":"Yup2 yesterday"}, +{"date":"2025-08-11","filename":"../tests/todos.rem","lineno":17,"d":11,"m":8,"y":2025,"is_todo":1,"trigbase":"2025-08-11","max_overdue":3,"priority":5000,"body":"Yup3 on 2025-08-11"}, +{"date":"2025-08-10","filename":"../tests/todos.rem","lineno":18,"d":10,"m":8,"y":2025,"is_todo":1,"trigbase":"2025-08-10","max_overdue":3,"priority":5000,"body":"Yup4 on 2025-08-10"} +]