this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: hook up the delete function

bnjox 7e45aaf9 5703310b

+16 -3
+16 -3
src/core/task.zig
··· 8 8 subcommand: ?union(enum) { 9 9 add: struct { 10 10 name: []const u8, 11 + desc: ?[]const u8 = null, 12 + }, 13 + delete: struct { 14 + id: []const u8, 11 15 }, 12 16 } = null, 13 17 ··· 21 25 \\ --list List all tasks 22 26 \\ 23 27 \\Commands: 24 - \\ add --name=<name> Add new task 28 + \\ add 29 + \\ --name=<name> Add new task 30 + \\ --desc=<description> The description of the task 31 + \\ delete 32 + \\ --id=<id> delete task id. 33 + \\ 25 34 \\ 26 35 \\Examples: 27 36 \\ tip task --list ··· 51 60 switch (subcommand) { 52 61 .add => |add| add_task(allocator, add.name, dir) catch { 53 62 std.debug.print("Failed to add task\n", .{}); 63 + return; 64 + }, 65 + .delete => |del| delete_task(allocator, del.id, dir) catch { 66 + std.debug.print("Failed to delete task with id: {s}\n", .{del.id}); 54 67 return; 55 68 }, 56 69 } ··· 105 118 106 119 for (tasks) |task| { 107 120 if (task.status == .completed) { 108 - std.debug.print(" [x]: {s}\n", .{task.title}); 121 + std.debug.print(" [x]: ({s}) - {s}\n", .{ task.id, task.title }); 109 122 } else { 110 - std.debug.print(" [ ]: {s}\n", .{task.title}); 123 + std.debug.print(" [ ]: ({s}) - {s}\n", .{ task.id, task.title }); 111 124 } 112 125 } 113 126 }