(no commit message)
[ptask.git] / src / tw.c
index d65ae61..c92c1ee 100644 (file)
--- a/src/tw.c
+++ b/src/tw.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "note.h"
 
 char *task_exec(char *opts)
 {
@@ -137,7 +138,7 @@ struct task **tw_get_all_tasks(const char *status)
                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;
@@ -263,3 +264,18 @@ void tw_add(const char *newdesc)
        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);
+}