diff options
| author | Julian Hurst <ark@mansus.space> | 2024-11-15 01:32:41 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2024-11-15 01:45:27 +0100 |
| commit | 86ef1210a686bce0db3ead2760bf4d401e23883a (patch) | |
| tree | 5782556e504ac95c7bc6b49241a53a0713443a7e /hatask.ha | |
| parent | d8e2f1042367e19cb10e00a2004960fe1a40582c (diff) | |
| download | hatask-86ef1210a686bce0db3ead2760bf4d401e23883a.tar.gz | |
Create config struct and pass to commands
Diffstat (limited to 'hatask.ha')
| -rw-r--r-- | hatask.ha | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -137,18 +137,20 @@ export fn main() void = { ); defer getopt::finish(&cmd); - let tasksdir: str = "tasks"; + const cfg: config = config { + tasksdir = "tasks", + }; for (let opt .. cmd.opts) { switch (opt.0) { case 'f' => - tasksdir = opt.1; + cfg.tasksdir = opt.1; case => abort(); }; }; - const tasks = match (listtasks(tasksdir)) { + const tasks = match (listtasks(cfg.tasksdir)) { case let e: fs::error => fmt::fatal(fs::strerror(e)); case let e: path::error => @@ -161,13 +163,13 @@ export fn main() void = { const com: (str, *getopt::command) = match (cmd.subcmd) { case void => - listall(tasks); + listall(cfg, tasks); return; case let subcmd: (str, *getopt::command) => yield (subcmd.0, subcmd.1); }; - match (execcommand(com.0, tasks, com.1)) { + match (execcommand(cfg, com.0, tasks, com.1)) { case let e: error => fmt::fatal(strerror(e)); case => |
