summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clap.zig2
-rw-r--r--src/streaming.zig9
2 files changed, 5 insertions, 6 deletions
diff --git a/clap.zig b/clap.zig
index 44c7d23..ac7f6c1 100644
--- a/clap.zig
+++ b/clap.zig
@@ -55,7 +55,7 @@ pub fn Param(comptime Id: type) type {
55} 55}
56 56
57/// Takes a string and parses it to a Param(Help). 57/// Takes a string and parses it to a Param(Help).
58/// This is the reverse of 'help2' but for at single parameter only. 58/// This is the reverse of 'help' but for at single parameter only.
59pub fn parseParam(line: []const u8) !Param(Help) { 59pub fn parseParam(line: []const u8) !Param(Help) {
60 var res = Param(Help){ 60 var res = Param(Help){
61 .id = Help{ 61 .id = Help{
diff --git a/src/streaming.zig b/src/streaming.zig
index 884a270..b5c3498 100644
--- a/src/streaming.zig
+++ b/src/streaming.zig
@@ -51,7 +51,7 @@ pub fn StreamingClap(comptime Id: type, comptime ArgIterator: type) type {
51 }; 51 };
52 52
53 switch (parser.state) { 53 switch (parser.state) {
54 State.Normal => { 54 .Normal => {
55 const full_arg = (try parser.iter.next()) orelse return null; 55 const full_arg = (try parser.iter.next()) orelse return null;
56 const arg_info = if (mem.eql(u8, full_arg, "--") or mem.eql(u8, full_arg, "-")) 56 const arg_info = if (mem.eql(u8, full_arg, "--") or mem.eql(u8, full_arg, "-"))
57 ArgInfo{ .arg = full_arg, .kind = .Positional } 57 ArgInfo{ .arg = full_arg, .kind = .Positional }
@@ -112,7 +112,7 @@ pub fn StreamingClap(comptime Id: type, comptime ArgIterator: type) type {
112 112
113 return error.InvalidArgument; 113 return error.InvalidArgument;
114 }, 114 },
115 @TagType(State).Chaining => |state| return try parser.chainging(state), 115 .Chaining => |state| return try parser.chainging(state),
116 } 116 }
117 } 117 }
118 118
@@ -177,9 +177,8 @@ fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, r
177 testing.expectEqualSlices(u8, expected_value, actual_value); 177 testing.expectEqualSlices(u8, expected_value, actual_value);
178 } 178 }
179 179
180 if (c.next() catch @panic("")) |_| { 180 if (c.next() catch unreachable) |_|
181 @panic(""); 181 unreachable;
182 }
183} 182}
184 183
185test "clap.streaming.StreamingClap: short params" { 184test "clap.streaming.StreamingClap: short params" {