aboutsummaryrefslogtreecommitdiff
path: root/config.ha
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2024-11-15 14:02:30 +0100
committerJulian Hurst <ark@mansus.space>2024-11-15 16:29:05 +0100
commite5d2f4eb34e6d6820a9f05855abe6a45994c4bd2 (patch)
tree70ab2fdea956c8c2276347c4c1c73b2dff443f25 /config.ha
parentba38c9e073db90b530f2ba4460fb124a930ea055 (diff)
downloadhatask-e5d2f4eb34e6d6820a9f05855abe6a45994c4bd2.tar.gz
Support -t flag and tags config field for filtering tasks by tags
Diffstat (limited to 'config.ha')
-rw-r--r--config.ha5
1 files changed, 5 insertions, 0 deletions
diff --git a/config.ha b/config.ha
index a452665..b70341a 100644
--- a/config.ha
+++ b/config.ha
@@ -9,6 +9,7 @@ use io;
type config = struct {
tasksdir: str,
context: str,
+ tags: []str,
};
type cerror = !(fs::error | path::error | ini::error);
@@ -23,6 +24,7 @@ fn readconfig() (config | cerror) = {
const c = config {
tasksdir = strings::dup("tasks"),
context = strings::dup("*"),
+ tags = [],
};
for (const en => ini::next(&sc)?) {
switch (en.1) {
@@ -30,6 +32,8 @@ fn readconfig() (config | cerror) = {
c.tasksdir = strings::dup(strings::trim(en.2));
case "context" =>
c.tasksdir = strings::dup(strings::trim(en.2));
+ case "tags" =>
+ c.tags = strings::dupall(strings::split(strings::trim(en.2), ","));
case =>
void;
};
@@ -40,6 +44,7 @@ fn readconfig() (config | cerror) = {
fn cfinish(cfg: *config) void = {
free(cfg.tasksdir);
free(cfg.context);
+ strings::freeall(cfg.tags);
};
fn strcerror(e: cerror) str = {