diff options
| author | Julian Hurst <ark@mansus.space> | 2024-11-15 22:11:00 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2024-11-15 22:11:47 +0100 |
| commit | e2ad2e09a8fd360640ec302e347e9ea8276bf618 (patch) | |
| tree | 821c98b3ff89af3d303f73c0c9b03a32d9dc0a2f /config.ha | |
| parent | d824f5503a8816e9cdd80b05e50ff8cc196b6e91 (diff) | |
| download | hatask-e2ad2e09a8fd360640ec302e347e9ea8276bf618.tar.gz | |
Add debug to config and improve printconfig
Diffstat (limited to 'config.ha')
| -rw-r--r-- | config.ha | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -11,6 +11,7 @@ type config = struct { tasksdir: str, context: str, tags: []str, + debug: bool, }; type cerror = !(fs::error | path::error | ini::error); @@ -26,6 +27,7 @@ fn readconfig() (config | cerror) = { tasksdir = strings::dup("tasks"), context = strings::dup("*"), tags = [], + debug = false, }; for (const en => ini::next(&sc)?) { switch (en.1) { @@ -35,6 +37,8 @@ fn readconfig() (config | cerror) = { c.context = strings::dup(strings::trim(en.2)); case "tags" => c.tags = strings::dupall(strings::split(strings::trim(en.2), ",")); + case "debug" => + c.debug = en.2 == "true"; case => void; }; @@ -62,9 +66,9 @@ fn strcerror(e: cerror) str = { }; fn printconfig(cfg: config) void = { - fmt::errorln(cfg.tasksdir)!; - fmt::errorln(cfg.context)!; - for (const tag .. cfg.tags) { - fmt::errorln(tag)!; - }; + fmt::errorfln("tasksdir: {}", cfg.tasksdir)!; + fmt::errorfln("context: {}", cfg.context)!; + const stags = strings::join(",", cfg.tags...); + defer free(stags); + fmt::errorfln("tags: {}", stags)!; }; |
