Hide completed tasks by default
This commit is contained in:
parent
dd0a0db947
commit
722c88a1b2
10
src/db.c
10
src/db.c
@ -190,7 +190,7 @@ void get_task(int id, task_t* t) {
|
||||
// t->id will be (-1) if not found
|
||||
}
|
||||
|
||||
int list_tasks() {
|
||||
int list_tasks(bool show_completed) {
|
||||
sqlite3* db = get_db();
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
@ -211,12 +211,12 @@ int list_tasks() {
|
||||
//* Warning: t just lives here (particularly t.text)
|
||||
|
||||
if (t.done) {
|
||||
printf(BOLD GREEN);
|
||||
if (show_completed) {
|
||||
printf(BOLD GREEN "[%d]" RESET " %s\n", t.id, t.text);
|
||||
}
|
||||
} else {
|
||||
printf(BOLD YELLOW);
|
||||
printf(BOLD YELLOW "[%d]" RESET " %s\n", t.id, t.text);
|
||||
}
|
||||
|
||||
printf("[%d]" RESET " %s\n", t.id, t.text);
|
||||
}
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
|
@ -38,7 +38,7 @@ void get_task(int id, task_t* t);
|
||||
/*
|
||||
Liste les tâches dans un format prédéfini
|
||||
*/
|
||||
int list_tasks();
|
||||
int list_tasks(bool show_completed);
|
||||
|
||||
/*
|
||||
Renvoie un identifiant de tâche encore non utilisé
|
||||
|
@ -10,11 +10,12 @@
|
||||
|
||||
void help(char* name) {
|
||||
printf(BLUE "\t-- TaKl " VERSION " --\n" RESET);
|
||||
printf("Utilisation: %s ( list | info | add | rm | done )\n", name);
|
||||
printf("Utilisation: %s ( list | add | info | rm | done )\n", name);
|
||||
printf("\tlist [-a:voir les tâches complétées]\n");
|
||||
printf("\tadd <task> [date]\n");
|
||||
printf("\tFormat de la date:\n");
|
||||
printf("\t\tRelatif: min+%%d, h+%%d, j+%%d\n");
|
||||
printf("\t\tAbsolu: dd/mm (pas de changement d'année pour l'instant\n");
|
||||
printf("\t\tAbsolu: dd/mm (pas de changement d'année pour l'instant)\n");
|
||||
printf("\tinfo <id1> <id2> ...\n");
|
||||
printf("\tdone <id1> <id2> ...\n");
|
||||
printf("\trm <id1> <id2> ...\n");
|
||||
@ -187,7 +188,7 @@ int main(int argc, char* argv[]) {
|
||||
if (!strcmp(argv[1], "add")) {
|
||||
return add(argc, argv);
|
||||
} else if (!strcmp(argv[1], "list")) {
|
||||
return list_tasks();
|
||||
return list_tasks(argc > 2 && !strcmp(argv[2], "-a"));
|
||||
} else if (!strcmp(argv[1], "info")) {
|
||||
return info(argc, argv);
|
||||
} else if (!strcmp(argv[1], "done")) {
|
||||
|
Loading…
Reference in New Issue
Block a user