From 25ddbaea75ec88b409057546b79bd95526790964 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Thu, 5 Sep 2019 23:51:59 +0200 Subject: use emun literals --- clap.zig | 2 +- src/streaming.zig | 9 ++++----- 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 { } /// Takes a string and parses it to a Param(Help). -/// This is the reverse of 'help2' but for at single parameter only. +/// This is the reverse of 'help' but for at single parameter only. pub fn parseParam(line: []const u8) !Param(Help) { var res = Param(Help){ .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 { }; switch (parser.state) { - State.Normal => { + .Normal => { const full_arg = (try parser.iter.next()) orelse return null; const arg_info = if (mem.eql(u8, full_arg, "--") or mem.eql(u8, full_arg, "-")) ArgInfo{ .arg = full_arg, .kind = .Positional } @@ -112,7 +112,7 @@ pub fn StreamingClap(comptime Id: type, comptime ArgIterator: type) type { return error.InvalidArgument; }, - @TagType(State).Chaining => |state| return try parser.chainging(state), + .Chaining => |state| return try parser.chainging(state), } } @@ -177,9 +177,8 @@ fn testNoErr(params: []const clap.Param(u8), args_strings: []const []const u8, r testing.expectEqualSlices(u8, expected_value, actual_value); } - if (c.next() catch @panic("")) |_| { - @panic(""); - } + if (c.next() catch unreachable) |_| + unreachable; } test "clap.streaming.StreamingClap: short params" { -- cgit v1.2.3