diff options
| -rw-r--r-- | build.zig.zon | 4 | ||||
| -rw-r--r-- | src/main.zig | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/build.zig.zon b/build.zig.zon index 30c1f64..f22e96a 100644 --- a/build.zig.zon +++ b/build.zig.zon | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | .paths = .{""}, | 5 | .paths = .{""}, |
| 6 | .dependencies = .{ | 6 | .dependencies = .{ |
| 7 | .clap = .{ | 7 | .clap = .{ |
| 8 | .url = "https://git.enes.lv/zig-clap/snapshot/zig-clap-0.9.1.tar.xz", | 8 | .url = "https://git.enes.lv/zig-clap/snapshot/zig-clap-7003678307b72bc25869308d7435a79114d1ac42.tar.xz", |
| 9 | .hash = "122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b", | 9 | .hash = "12208caa9e66620e2937cbd9d273e84dbab659c099bea8c985b3d46c2201f8d7c244", |
| 10 | }, | 10 | }, |
| 11 | .libarchive = .{ | 11 | .libarchive = .{ |
| 12 | // .path = "../zig-libarchive", | 12 | // .path = "../zig-libarchive", |
diff --git a/src/main.zig b/src/main.zig index 57baac1..0fe6f16 100644 --- a/src/main.zig +++ b/src/main.zig | |||
| @@ -55,7 +55,7 @@ const Command = enum { | |||
| 55 | 55 | ||
| 56 | const CommandMap = blk: { | 56 | const CommandMap = blk: { |
| 57 | const Pair = Tuple(&.{ []const u8, Command }); | 57 | const Pair = Tuple(&.{ []const u8, Command }); |
| 58 | const commands = @typeInfo(Command).Enum.fields; | 58 | const commands = @typeInfo(Command).@"enum".fields; |
| 59 | var map_data: [commands.len + 2]Pair = undefined; | 59 | var map_data: [commands.len + 2]Pair = undefined; |
| 60 | map_data[0] = .{ "--help", .help }; | 60 | map_data[0] = .{ "--help", .help }; |
| 61 | map_data[1] = .{ "--version", .version }; | 61 | map_data[1] = .{ "--version", .version }; |
| @@ -77,7 +77,7 @@ fn dispatch( | |||
| 77 | // TODO: This can still be improved, currently we're looping through all | 77 | // TODO: This can still be improved, currently we're looping through all |
| 78 | // possible values, it could be somehow made into a switch. | 78 | // possible values, it could be somehow made into a switch. |
| 79 | const cmd_enum = CommandMap.get(cmd) orelse return @call(.auto, default_fn, args); | 79 | const cmd_enum = CommandMap.get(cmd) orelse return @call(.auto, default_fn, args); |
| 80 | const commands = @typeInfo(Command).Enum.fields; | 80 | const commands = @typeInfo(Command).@"enum".fields; |
| 81 | inline for (commands) |command| { | 81 | inline for (commands) |command| { |
| 82 | if (@intFromEnum(cmd_enum) == command.value) { | 82 | if (@intFromEnum(cmd_enum) == command.value) { |
| 83 | const fun = @field(@field(@This(), command.name), fn_name); | 83 | const fun = @field(@field(@This(), command.name), fn_name); |