From e32af706fdbafcf74306f70fc41f1bf23b13bab3 Mon Sep 17 00:00:00 2001 From: Igor Shapiro Date: Sun, 17 Sep 2023 21:36:58 +0300 Subject: [PATCH] feat(zig): update code to work with zig 0.11 --- build.zig | 10 ++++++---- src/main.zig | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index 9534436..db21e60 100644 --- a/build.zig +++ b/build.zig @@ -1,10 +1,12 @@ const Builder = @import("std").build.Builder; pub fn build(b: *Builder) void { - const mode = b.standardReleaseOptions(); - const lib = b.addStaticLibrary("zinput", "src/main.zig"); - lib.setBuildMode(mode); - lib.install(); + const mode = b.standardOptimizeOption(.{}); + // TODO: figure out how to add a static library in zig v0.11.0+ + // See also: https://devlog.hexops.com/2023/zig-0-11-breaking-build-changes/#creating-tests-libraries-and-executables + + // const lib = b.addStaticLibrary(.{ .name = "zinput", .main_pkg_path = "src/main.zig" }); + // _ = lib; var main_tests = b.addTest("src/main.zig"); main_tests.setBuildMode(mode); diff --git a/src/main.zig b/src/main.zig index 8d0acc6..835b1cc 100644 --- a/src/main.zig +++ b/src/main.zig @@ -86,7 +86,7 @@ pub fn askSelectOne(prompt: []const u8, comptime options: type) !options { inline for (@typeInfo(options).Enum.fields) |option| if (std.ascii.eqlIgnoreCase(option.name, result)) - return @intToEnum(options, option.value); + return std.meta.intToEnum(options, option.value); // return option.value; try out.writeSeq(.{ Fg.Red, "Error: Invalid option, please try again.\n" });