build: update to Zig 0.11.0
This commit is contained in:
		| @ -41,14 +41,14 @@ pub fn parser(comptime Arg: type, comptime flags: []const Flag) type { | ||||
|                     const field: std.builtin.Type.StructField = switch (flag.kind) { | ||||
|                         .boolean => .{ | ||||
|                             .name = flag.name, | ||||
|                             .field_type = bool, | ||||
|                             .type = bool, | ||||
|                             .default_value = &false, | ||||
|                             .is_comptime = false, | ||||
|                             .alignment = @alignOf(bool), | ||||
|                         }, | ||||
|                         .arg => .{ | ||||
|                             .name = flag.name, | ||||
|                             .field_type = ?[:0]const u8, | ||||
|                             .type = ?[:0]const u8, | ||||
|                             .default_value = &@as(?[:0]const u8, null), | ||||
|                             .is_comptime = false, | ||||
|                             .alignment = @alignOf(?[:0]const u8), | ||||
| @ -70,8 +70,13 @@ pub fn parser(comptime Arg: type, comptime flags: []const Flag) type { | ||||
|  | ||||
|             var i: usize = 0; | ||||
|             outer: while (i < args.len) : (i += 1) { | ||||
|                 const arg = switch (Arg) { | ||||
|                     [*:0]const u8 => mem.sliceTo(args[i], 0), | ||||
|                     [:0]const u8 => args[i], | ||||
|                     else => unreachable, | ||||
|                 }; | ||||
|                 inline for (flags) |flag| { | ||||
|                     if (mem.eql(u8, "-" ++ flag.name, mem.span(args[i]))) { | ||||
|                     if (mem.eql(u8, "-" ++ flag.name, arg)) { | ||||
|                         switch (flag.kind) { | ||||
|                             .boolean => @field(result_flags, flag.name) = true, | ||||
|                             .arg => { | ||||
| @ -81,7 +86,11 @@ pub fn parser(comptime Arg: type, comptime flags: []const Flag) type { | ||||
|                                         "' requires an argument but none was provided!", .{}); | ||||
|                                     return error.MissingFlagArgument; | ||||
|                                 } | ||||
|                                 @field(result_flags, flag.name) = mem.span(args[i]); | ||||
|                                 @field(result_flags, flag.name) = switch (Arg) { | ||||
|                                     [*:0]const u8 => mem.sliceTo(args[i], 0), | ||||
|                                     [:0]const u8 => args[i], | ||||
|                                     else => unreachable, | ||||
|                                 }; | ||||
|                             }, | ||||
|                         } | ||||
|                         continue :outer; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user