···22const mito = @import("mitochondria");
3344pub fn main() !void {
55- var gpa = std.heap.GeneralPurposeAllocator(.{}).init;
55+ var gpa = std.heap.DebugAllocator(.{}).init;
6677 const Parser = mito.flag.parser(&.{
88 .{ .name = "help", .kind = .boolean, .desc = "Print this help message" },
+22
examples/slice_iter.zig
···11+const std = @import("std");
22+const mitochondria = @import("mitochondria");
33+const SliceIterator = mitochondria.SliceIterator;
44+55+pub fn main() void {
66+ const array_of_strings = [_][]const u8{
77+ "Lorem ipsum dolor sit amet",
88+ "Foo bar baz qux",
99+ "Disturbing the peace,",
1010+ "Look into my eyes,",
1111+ "Now tell me the things you blabbing about",
1212+ "Behind my back",
1313+ "The tenacity I hold it's hard to break down",
1414+ "It's too late for apologies",
1515+ "It's going down now",
1616+ };
1717+1818+ var strings = SliceIterator([]const u8).init(&array_of_strings);
1919+ while (strings.next()) |str| {
2020+ std.debug.print("{s}\n", .{str});
2121+ }
2222+}
+7-2
src/flag.zig
···105105 if (std.mem.eql(u8, "-" ++ flag_name, a)) {
106106 flag_found = true;
107107 switch (flag_map.kinds[j]) {
108108- .boolean => @field(out_flags, flag_name) = !@field(out_flags, flag_name),
108108+ .boolean => {
109109+ @field(out_flags, flag_name) = !@field(out_flags, flag_name);
110110+ },
109111 .valued => {
110112 i += 1;
111113 if (i == args.len) {
112114 if (options.log)
113113- std.log.err("option '{s}' requires an argument but none was provided!", .{flag_name});
115115+ std.log.err(
116116+ "option '{s}' requires an argument but none was provided!",
117117+ .{flag_name},
118118+ );
114119 return error.MissingValue;
115120 }
116121