diff options
| -rw-r--r-- | cmd.ha | 16 | ||||
| -rw-r--r-- | hatask.ha | 2 |
2 files changed, 18 insertions, 0 deletions
@@ -32,6 +32,10 @@ const commands: [_]command = [ func = &show, }, command { + names = ["a", "add"], + func = &add, + }, + command { names = ["w", "write"], func = &write, }, @@ -55,6 +59,18 @@ fn execcommand(cfg: config, name: str, tasks: []task, args: arguments) (void | e }; }; +fn add(cfg: config, tasks: []task, a: arguments) (void | task | error) = { + const args = a.args; + if (len(args) != 1z) { + getopt::printhelp(os::stderr, "write", a.help)?; + return; + }; + + let buf = path::init(cfg.tasksdir, args[0])?; + const c = exec::cmd("vim", path::string(&buf))?; + exec::exec(&c); +}; + fn write(cfg: config, tasks: []task, a: arguments) (void | task | error) = { const args = a.args; if (len(args) != 1z) { @@ -128,6 +128,8 @@ export fn main() void = { ("f", ["filter tasks", "id"]: []getopt::help), ("show", ["show task details", "id"]: []getopt::help), ("s", ["show task details", "id"]: []getopt::help), + ("add", ["add a task", "id"]: []getopt::help), + ("a", ["add a task", "id"]: []getopt::help), ("write", ["write a task", "id"]: []getopt::help), ("w", ["write a task", "id"]: []getopt::help), ("done", ["delete a task", "id"]: []getopt::help), |
