aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd.ha16
-rw-r--r--hatask.ha2
2 files changed, 18 insertions, 0 deletions
diff --git a/cmd.ha b/cmd.ha
index 4c85b0a..d22c70c 100644
--- a/cmd.ha
+++ b/cmd.ha
@@ -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) {
diff --git a/hatask.ha b/hatask.ha
index 7807000..e7a1274 100644
--- a/hatask.ha
+++ b/hatask.ha
@@ -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),