#include <stdlib.h>
#include <string.h>
+#include "note.h"
char *task_exec(char *opts)
{
json = json_object_object_get(jtask, "uuid");
tasks[i]->uuid = strdup(json_object_get_string(json));
- tasks[i]->note = NULL;
+ tasks[i]->note = note_get(tasks[i]->uuid);
}
tasks[n] = NULL;
free(str);
free(opts);
}
+
+void tw_done(const char *uuid)
+{
+ char *opts;
+
+ opts = malloc(1
+ + strlen(uuid)
+ + strlen(" done")
+ + 1);
+ sprintf(opts, " %s done", uuid);
+
+ task_exec(opts);
+
+ free(opts);
+}
+
+static void task_free(struct task *task)
+{
+ if (!task)
+ return ;
+
+ free(task->description);
+ free(task->status);
+ free(task->uuid);
+ free(task->note);
+ free(task->project);
+ free(task->priority);
+
+ free(task);
+}
+
+void tw_task_list_free(struct task **tasks)
+{
+ struct task **cur;
+
+ if (!tasks)
+ return ;
+
+ for (cur = tasks; *cur; cur++)
+ task_free(*cur);
+
+ free(tasks);
+}