diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 11:48:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | c3c3ef27ede2f69ef4f8c6acb10808f02ee46bb2 (patch) | |
| tree | 523d03bbb555a4a6d9c991fa4ec43723223cda18 /src/builtins.zig | |
| parent | cef529dc8cd080198f79d2b26bffbe9c7cf3e8bd (diff) | |
| download | pardes-c3c3ef27ede2f69ef4f8c6acb10808f02ee46bb2.tar.gz pardes-c3c3ef27ede2f69ef4f8c6acb10808f02ee46bb2.zip | |
A builtin or setting this build lacks is refused GUI-only, from an exec too
On a terminal, Fonts written to an exec was no builtin there, so it ran as a shell command and ended exit 127; ctl said unknown control message. Both now say Fonts is GUI-only, invalid here (a builtin another platform's build has, not in this build).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 9025da6d..b0499dc0 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -56,6 +56,22 @@ fn isEnabled(comptime T: type) bool { return !@hasDecl(T, "enabled") or T.enabled; } +/// Why `word`, a builtin some build has, is none in this one: `GUI-only` +/// for the GUI's own (`gui_only`), else `not in this build`; null for a +/// word that is one here, or in no build. +pub fn absentWhy(name: []const u8) ?[]const u8 { + @setEvalBranchQuota(20000); + inline for (@typeInfo(@This()).@"struct".decls) |d| { + if (comptime @TypeOf(@field(@This(), d.name)) == type) { + const T = @field(@This(), d.name); + if (comptime @typeInfo(T) == .@"struct" and @hasDecl(T, "run") and !isEnabled(T)) { + if (std.mem.eql(u8, d.name, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; + } + } + } + return null; +} + fn manualBuiltinCount() comptime_int { comptime { var count = 0; @@ -814,6 +830,7 @@ pub const Fonts = struct { pub const scope: Scope = .session; pub const output: OutputTraits = .{ .name = config.fonts_buffer, .steps = true, .commands = true }; pub const enabled = capabilities.font_picker; + pub const gui_only = true; pub fn run(c: Ctx) void { if (comptime enabled) apply(c) else unreachable; } @@ -1319,6 +1336,7 @@ pub const EffectCode = struct { pub const takes_arg = true; pub const requires_arg = true; pub const enabled = capabilities.panel_transitions or capabilities.scene_shaders; + pub const gui_only = true; pub const output: OutputTraits = .{ .name = config.effect_code_buffer }; pub fn run(c: Ctx) void { if (comptime enabled) @@ -1335,6 +1353,7 @@ pub const Pet = struct { pub const takes_arg = true; pub const requires_arg = true; pub const enabled = pardes.platform == .gui; + pub const gui_only = true; pub fn run(c: Ctx) void { const name = std.mem.trim(u8, c.arg orelse return, " \t\r\n"); c.p.settings.pet = std.meta.stringToEnum(@TypeOf(c.p.settings.pet), name) orelse return; |
