Make --dump format optional and improve markdown rendering

This commit is contained in:
Adrià Arrufat
2026-02-18 19:33:32 +09:00
parent 0ec4522f9e
commit ce5dad722f
3 changed files with 33 additions and 37 deletions

View File

@@ -560,15 +560,17 @@ fn parseFetchArgs(
while (args.next()) |opt| {
if (std.mem.eql(u8, "--dump", opt)) {
const str = args.next() orelse {
log.fatal(.app, "missing argument value", .{ .arg = "--dump" });
return error.InvalidArgument;
};
dump_mode = std.meta.stringToEnum(DumpFormat, str) orelse {
log.fatal(.app, "invalid option choice", .{ .arg = "--dump", .value = str });
return error.InvalidArgument;
};
var peek_args = args.*;
if (peek_args.next()) |next_arg| {
if (std.meta.stringToEnum(DumpFormat, next_arg)) |mode| {
dump_mode = mode;
_ = args.next();
} else {
dump_mode = .html;
}
} else {
dump_mode = .html;
}
continue;
}