diff options
| author | Julian Hurst <ark@mansus.space> | 2024-11-15 13:29:02 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2024-11-15 13:29:19 +0100 |
| commit | ba38c9e073db90b530f2ba4460fb124a930ea055 (patch) | |
| tree | 400febfaff84bceb2901d1fc6d00a99ad6406def /hatask.ha | |
| parent | 77128923c2f1a65c723c653532d32dfe99d2f411 (diff) | |
| download | hatask-ba38c9e073db90b530f2ba4460fb124a930ea055.tar.gz | |
Support tags
Diffstat (limited to 'hatask.ha')
| -rw-r--r-- | hatask.ha | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -19,7 +19,7 @@ type task = struct { name: str, path: str, context: (str | void), - tags: ([]str | void), + tags: []str, priority: uint, content: str, }; @@ -76,7 +76,7 @@ fn readtask(taskpath: str) (task | rtaskerror) = { defer ini::finish(&sc); let t = task { context = void, - tags = void, + tags = [], ... }; for (let entry: ini::entry => ini::next(&sc)?) { @@ -85,6 +85,8 @@ fn readtask(taskpath: str) (task | rtaskerror) = { t.name = strings::dup(strings::trim(entry.2)); case "priority" => t.priority = strconv::stou(entry.2)?; + case "tags" => + t.tags = strings::dupall(strings::split(entry.2, ",")); case => void; }; @@ -104,9 +106,7 @@ fn freetask(t: *task) void = { if (t.context is str) { free(t.context as str); }; - if (t.tags is []str) { - strings::freeall(t.tags as []str); - }; + strings::freeall(t.tags); }; fn finishall(tasks: []task) void = { |
