cli: handle "-e" as the command to execute

This commit is contained in:
Mitchell Hashimoto
2023-10-27 15:57:20 -07:00
parent 9c56bd5dba
commit 4104f78cba
2 changed files with 35 additions and 0 deletions

View File

@@ -64,6 +64,11 @@ pub fn parse(comptime T: type, alloc: Allocator, dst: *T, iter: anytype) !void {
};
while (iter.next()) |arg| {
// Do manual parsing if we have a hook for it.
if (@hasDecl(T, "parseManuallyHook")) {
if (!try dst.parseManuallyHook(arena_alloc, arg, iter)) return;
}
if (mem.startsWith(u8, arg, "--")) {
var key: []const u8 = arg[2..];
const value: ?[]const u8 = value: {