some setup for subcommands: do nothing right now, experimenting with pointers

This commit is contained in:
2026-05-23 23:33:42 +02:00
parent 067078b28f
commit 88504d6043
8 changed files with 71 additions and 43 deletions
+32
View File
@@ -0,0 +1,32 @@
const std = @import("std");
pub const Handler = *const fn (*std.process.Args.Iterator) anyerror!void;
pub const Subcommand = struct {
name: []const u8,
handler: Handler,
};
pub const subcommands = [_]Subcommand{
.{ .name = "add", .handler = handleAdd },
.{ .name = "remove", .handler = handleRemove },
.{ .name = "done", .handler = handleDone },
.{ .name = "list", .handler = handleList },
};
pub fn handleAdd(args: *std.process.Args.Iterator) !void {
_ = args;
std.debug.print("add!", .{});
}
pub fn handleRemove(args: *std.process.Args.Iterator) !void {
_ = args;
}
pub fn handleDone(args: *std.process.Args.Iterator) !void {
_ = args;
}
pub fn handleList(args: *std.process.Args.Iterator) !void {
_ = args;
}