Highlight expired tasks
This commit is contained in:
parent
722c88a1b2
commit
f7f674f7a0
11
src/db.c
11
src/db.c
@ -201,6 +201,7 @@ int list_tasks(bool show_completed) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
time_t now = time(0);
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
task_t t;
|
||||
|
||||
@ -212,10 +213,16 @@ int list_tasks(bool show_completed) {
|
||||
|
||||
if (t.done) {
|
||||
if (show_completed) {
|
||||
printf(BOLD GREEN "[%d]" RESET " %s\n", t.id, t.text);
|
||||
printf(BOLD GREEN); // Task completed
|
||||
}
|
||||
} else if (difftime(now, t.due_to) <= 0 || t.due_to == 0) {
|
||||
printf(BOLD YELLOW); // Task not completed but that is fine
|
||||
} else {
|
||||
printf(BOLD YELLOW "[%d]" RESET " %s\n", t.id, t.text);
|
||||
printf(BOLD RED); // Task not completed but should be !
|
||||
}
|
||||
|
||||
if (!t.done || show_completed) {
|
||||
printf("[%d]" RESET " %s\n", t.id, t.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user