diff options
Diffstat (limited to '')
| -rw-r--r-- | src/comptime.zig | 5 | ||||
| -rw-r--r-- | src/index.zig | 5 | ||||
| -rw-r--r-- | src/streaming.zig | 2 |
3 files changed, 4 insertions, 8 deletions
diff --git a/src/comptime.zig b/src/comptime.zig index ddcd7e1..808915d 100644 --- a/src/comptime.zig +++ b/src/comptime.zig | |||
| @@ -24,9 +24,8 @@ pub fn ComptimeClap(comptime Id: type, comptime params: []const clap.Param(Id)) | |||
| 24 | break :blk res; | 24 | break :blk res; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | converted_params = converted_params ++ []clap.Param(usize){ | 27 | const converted = clap.Param(usize).init(index, param.takes_value, param.names); |
| 28 | clap.Param(usize).init(index, param.takes_value, param.names), | 28 | converted_params = converted_params ++ []clap.Param(usize){converted}; |
| 29 | }; | ||
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | return struct { | 31 | return struct { |
diff --git a/src/index.zig b/src/index.zig index 5900424..225eb9c 100644 --- a/src/index.zig +++ b/src/index.zig | |||
| @@ -91,11 +91,10 @@ pub fn Param(comptime Id: type) type { | |||
| 91 | return init(id, true, Names{ .short = null, .long = null }); | 91 | return init(id, true, Names{ .short = null, .long = null }); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | fn init(id: Id, takes_value: bool, names: Names) @This() { | 94 | pub fn init(id: Id, takes_value: bool, names: Names) @This() { |
| 95 | // Assert, that if the param have no name, then it has to take | 95 | // Assert, that if the param have no name, then it has to take |
| 96 | // a value. | 96 | // a value. |
| 97 | debug.assert( | 97 | debug.assert(names.long != null or |
| 98 | names.long != null or | ||
| 99 | names.short != null or | 98 | names.short != null or |
| 100 | takes_value); | 99 | takes_value); |
| 101 | 100 | ||
diff --git a/src/streaming.zig b/src/streaming.zig index 99eaecb..f33fd96 100644 --- a/src/streaming.zig +++ b/src/streaming.zig | |||
| @@ -30,7 +30,6 @@ pub fn Arg(comptime Id: type) type { | |||
| 30 | /// ::StreamingClap.next to parse all the arguments of your program. | 30 | /// ::StreamingClap.next to parse all the arguments of your program. |
| 31 | pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { | 31 | pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { |
| 32 | return struct { | 32 | return struct { |
| 33 | |||
| 34 | const State = union(enum) { | 33 | const State = union(enum) { |
| 35 | Normal, | 34 | Normal, |
| 36 | Chaining: Chaining, | 35 | Chaining: Chaining, |
| @@ -189,7 +188,6 @@ pub fn StreamingClap(comptime Id: type, comptime ArgError: type) type { | |||
| 189 | }; | 188 | }; |
| 190 | } | 189 | } |
| 191 | 190 | ||
| 192 | |||
| 193 | fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, results: []const Arg(u8)) void { | 191 | fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, results: []const Arg(u8)) void { |
| 194 | var arg_iter = args.SliceIterator.init(args_strings); | 192 | var arg_iter = args.SliceIterator.init(args_strings); |
| 195 | var c = StreamingClap(u8, args.SliceIterator.Error).init(params, &arg_iter.iter); | 193 | var c = StreamingClap(u8, args.SliceIterator.Error).init(params, &arg_iter.iter); |