mirror of
https://git.aramjonghu.nl/AramJonghu/nfi.git
synced 2026-06-06 20:38:24 +02:00
some setup for subcommands: do nothing right now, experimenting with pointers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user