authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-05-30 01:15:04 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-05-30 01:15:04 -07:00
log74f0ddb0a4dfa7921739b88cc381951a6b6e73ce
treef89839e96624ae2b27ffdc52e540aefd234fc196
parent3dcc531937b58d787e183c25bad535c91bab1f7d

add globalOption


2 files changed, 10 insertions(+), 0 deletions(-)

src/globalOption.zig created+9
......@@ -0,0 +1,9 @@
1const std = @import("std");
2const string = []const u8;
3const extras = @import("./lib.zig");
4const root = @import("root");
5
6pub fn globalOption(comptime T: type, comptime name: []const u8) ?T {
7 if (!@hasDecl(root, name)) return null;
8 return @as(T, @field(root, name));
9}
src/lib.zig+1
......@@ -92,3 +92,4 @@ pub fn fd_realpath(fd: std.os.fd_t) ![std.fs.MAX_PATH_BYTES:0]u8 {
9292pub usingnamespace @import("./rawInt.zig");
9393pub usingnamespace @import("./expectSimilarType.zig");
9494pub usingnamespace @import("./rawIntBytes.zig");
95pub usingnamespace @import("./globalOption.zig");