diff options
Diffstat (limited to '')
| -rw-r--r-- | src/comptime.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/comptime.zig b/src/comptime.zig index 5339da3..b9021de 100644 --- a/src/comptime.zig +++ b/src/comptime.zig | |||
| @@ -34,7 +34,7 @@ pub fn ComptimeClap(comptime Id: type, comptime params: []const clap.Param(Id)) | |||
| 34 | pos: []const []const u8, | 34 | pos: []const []const u8, |
| 35 | allocator: *mem.Allocator, | 35 | allocator: *mem.Allocator, |
| 36 | 36 | ||
| 37 | pub fn parse(allocator: *mem.Allocator, comptime ArgError: type, iter: *clap.args.Iterator(ArgError)) !@This() { | 37 | pub fn parse(allocator: *mem.Allocator, comptime ArgIter: type, iter: *ArgIter) !@This() { |
| 38 | var pos = std.ArrayList([]const u8).init(allocator); | 38 | var pos = std.ArrayList([]const u8).init(allocator); |
| 39 | var res = @This(){ | 39 | var res = @This(){ |
| 40 | .options = []?[]const u8{null} ** options, | 40 | .options = []?[]const u8{null} ** options, |
| @@ -43,7 +43,7 @@ pub fn ComptimeClap(comptime Id: type, comptime params: []const clap.Param(Id)) | |||
| 43 | .allocator = allocator, | 43 | .allocator = allocator, |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | var stream = clap.StreamingClap(usize, ArgError).init(converted_params, iter); | 46 | var stream = clap.StreamingClap(usize, ArgIter).init(converted_params, iter); |
| 47 | while (try stream.next()) |arg| { | 47 | while (try stream.next()) |arg| { |
| 48 | const param = arg.param; | 48 | const param = arg.param; |
| 49 | if (param.names.long == null and param.names.short == null) { | 49 | if (param.names.long == null and param.names.short == null) { |
| @@ -124,10 +124,10 @@ test "clap.comptime.ComptimeClap" { | |||
| 124 | 124 | ||
| 125 | var buf: [1024]u8 = undefined; | 125 | var buf: [1024]u8 = undefined; |
| 126 | var fb_allocator = heap.FixedBufferAllocator.init(buf[0..]); | 126 | var fb_allocator = heap.FixedBufferAllocator.init(buf[0..]); |
| 127 | var arg_iter = clap.args.SliceIterator.init([][]const u8{ | 127 | var iter = clap.args.SliceIterator.init([][]const u8{ |
| 128 | "-a", "-c", "0", "something", | 128 | "-a", "-c", "0", "something", |
| 129 | }); | 129 | }); |
| 130 | var args = try Clap.parse(&fb_allocator.allocator, clap.args.SliceIterator.Error, &arg_iter.iter); | 130 | var args = try Clap.parse(&fb_allocator.allocator, clap.args.SliceIterator, &iter); |
| 131 | defer args.deinit(); | 131 | defer args.deinit(); |
| 132 | 132 | ||
| 133 | testing.expect(args.flag("-a")); | 133 | testing.expect(args.flag("-a")); |