summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:22:34 -0300
committerGabriel Schneider <[email protected]>2026-11-04 23:35:18 -0300
commit0495379f3cd3130f6a407f81a68b3f6e1947cf16 (patch)
treee504cc25058865197a8b16cb638e3d757ed4618a
parentae9ecfd6150497f1b1f75f38d134d5dd2f2dee11 (diff)
downloadpardes-0495379f3cd3130f6a407f81a68b3f6e1947cf16.tar.gz
pardes-0495379f3cd3130f6a407f81a68b3f6e1947cf16.zip
builtins: sixteen comptime enabled guards go, with the run-to-apply splits they made, as a builtin its build leaves out is never registered so its run is never analysed (checked by the web build and a -Dmupdf=false core); TreeContext's stays, as only the esp32p4 build leaves it out and that build fails at the base already
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
-rw-r--r--src/builtins.zig65
1 files changed, 16 insertions, 49 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 777ad989..a6a2f95b 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -777,10 +777,7 @@ pub const Detach = struct {
pub const scope: Scope = .session;
pub const enabled = pardes.can_attach;
pub fn run(c: Ctx) void {
- if (comptime enabled)
- c.p.emit(.{ .detach = .{ .pane = @intCast(c.id) } })
- else
- unreachable;
+ c.p.emit(.{ .detach = .{ .pane = @intCast(c.id) } });
}
};
@@ -790,7 +787,6 @@ pub const Adopt = struct {
pub const scope: Scope = .session;
pub const enabled = pardes.can_attach;
pub fn run(c: Ctx) void {
- if (comptime !enabled) unreachable;
const adopt = c.p.host.vtable.adopt orelse return c.p.reportFailure(c.id, "Adopt: no pardes daemon is keeping shells for this session");
adopt(c.p.host.ctx, @intCast(c.id));
}
@@ -803,7 +799,6 @@ pub const Upgrade = struct {
pub const scope: Scope = .session;
pub const enabled = pardes.can_attach;
pub fn run(c: Ctx) void {
- if (comptime !enabled) unreachable;
const upgrade = c.p.host.vtable.upgrade orelse return c.p.reportFailure(c.id, "Upgrade: this pardes cannot move to another build in place");
upgrade(c.p.host.ctx, @intCast(c.id));
}
@@ -816,7 +811,6 @@ pub const Mount = struct {
pub const requires_arg = true;
pub const enabled = pardes.hosted;
pub fn run(c: Ctx) void {
- if (comptime !enabled) unreachable;
var args = std.mem.tokenizeAny(u8, c.arg orelse "", " \t");
const e_args = "wrong #args in control message \"Mount\": Mount name dial";
const name = args.next() orelse return c.p.reportFailure(c.id, e_args);
@@ -859,7 +853,6 @@ pub const Unmount = struct {
pub const requires_arg = true;
pub const enabled = pardes.hosted;
pub fn run(c: Ctx) void {
- if (comptime !enabled) unreachable;
var args = std.mem.tokenizeAny(u8, c.arg orelse "", " \t");
const name = args.next() orelse return c.p.reportError(c.id, "Unmount name", error.MissingArgument);
if (args.next() != null) return c.p.reportError(c.id, "Unmount name", error.TooManyArguments);
@@ -913,7 +906,6 @@ pub const ThemeFile = struct {
pub const requires_arg = true;
pub const enabled = pardes.hosted;
pub fn run(c: Ctx) void {
- if (comptime !enabled) unreachable;
var home_buf: [4096]u8 = undefined;
const arg = pardes.filesystem.expandHome(std.mem.trim(u8, c.arg orelse return, " \t\r\n"), &home_buf);
// Said with why, not "invalid theme path".
@@ -930,13 +922,11 @@ pub const DumpThemes = struct {
pub const scope: Scope = .session;
pub const enabled = pardes.hosted;
pub fn run(c: Ctx) void {
- if (comptime enabled) {
- if (c.p.configDir() == null) {
- c.p.reportError(c.id, "dump themes", error.NoConfigDirectory);
- return;
- }
- c.p.emit(.{ .dump_themes = .{ .pane = @intCast(c.id) } });
- } else unreachable;
+ if (c.p.configDir() == null) {
+ c.p.reportError(c.id, "dump themes", error.NoConfigDirectory);
+ return;
+ }
+ c.p.emit(.{ .dump_themes = .{ .pane = @intCast(c.id) } });
}
};
@@ -948,9 +938,6 @@ pub const Fonts = struct {
pub const gui_only = true;
pub const in_window = true;
pub fn run(c: Ctx) void {
- if (comptime enabled) apply(c) else unreachable;
- }
- fn apply(c: Ctx) void {
panes.Output.openFonts(c.p, c.id) catch |err| c.p.reportError(c.id, "fonts", err);
}
};
@@ -996,9 +983,6 @@ pub const PdfFit = struct {
pub const enabled = pardes.pdf_enabled;
pub const takes_arg = true;
pub fn run(c: Ctx) void {
- if (comptime enabled) apply(c) else unreachable;
- }
- fn apply(c: Ctx) void {
const state = &(c.pane.pdf orelse return);
if (c.arg != null) {
const want = stateArg(c, panes.Pdf.FitMode, "PdfFit", "width or height") orelse return;
@@ -1015,9 +999,6 @@ pub const PdfTint = struct {
pub const enabled = pardes.pdf_enabled;
pub const takes_arg = true;
pub fn run(c: Ctx) void {
- if (comptime enabled) apply(c) else unreachable;
- }
- fn apply(c: Ctx) void {
const state = &(c.pane.pdf orelse return);
if (c.arg != null) {
const want = stateArg(c, panes.Pdf.TintMode, "PdfTint", "disabled, filtered or full") orelse return;
@@ -1034,9 +1015,6 @@ pub const PdfSections = struct {
pub const output: OutputTraits = .{ .name = config.pdf_sections_buffer, .steps = true, .locations = true };
pub const enabled = pardes.pdf_enabled;
pub fn run(c: Ctx) void {
- if (comptime enabled) apply(c) else unreachable;
- }
- fn apply(c: Ctx) void {
panes.Pdf.openSections(c.p, c.id);
}
};
@@ -1680,11 +1658,8 @@ pub const EffectCode = struct {
pub const gui_only = true;
pub const output: OutputTraits = .{ .name = config.effect_code_buffer };
pub fn run(c: Ctx) void {
- if (comptime enabled)
- panes.Output.openEffectCode(c.p, c.id, c.arg orelse return) catch |err|
- c.p.reportError(c.id, "effect code", err)
- else
- unreachable;
+ panes.Output.openEffectCode(c.p, c.id, c.arg orelse return) catch |err|
+ c.p.reportError(c.id, "effect code", err);
}
};
@@ -2079,10 +2054,8 @@ pub const Peek = struct {
pub const enabled = Board.enabled;
pub const output: OutputTraits = .{ .name = config.peek_buffer };
pub fn run(c: Ctx) void {
- if (comptime enabled) {
- Board.peek(c.p, c.id, c.arg orelse "") catch |err|
- c.p.reportError(c.id, "peek", err);
- } else unreachable;
+ Board.peek(c.p, c.id, c.arg orelse "") catch |err|
+ c.p.reportError(c.id, "peek", err);
}
};
@@ -2093,10 +2066,8 @@ pub const Poke = struct {
pub const requires_arg = true;
pub const enabled = Board.enabled;
pub fn run(c: Ctx) void {
- if (comptime enabled) {
- Board.poke(c.p, c.id, c.arg orelse "") catch |err|
- c.p.reportError(c.id, "poke", err);
- } else unreachable;
+ Board.poke(c.p, c.id, c.arg orelse "") catch |err|
+ c.p.reportError(c.id, "poke", err);
}
};
@@ -2108,10 +2079,8 @@ pub const Hexdump = struct {
pub const enabled = Board.enabled;
pub const output: OutputTraits = .{ .name = config.hexdump_buffer };
pub fn run(c: Ctx) void {
- if (comptime enabled) {
- Board.hexdump(c.p, c.id, c.arg orelse "") catch |err|
- c.p.reportError(c.id, "hexdump", err);
- } else unreachable;
+ Board.hexdump(c.p, c.id, c.arg orelse "") catch |err|
+ c.p.reportError(c.id, "hexdump", err);
}
};
@@ -2122,10 +2091,8 @@ pub const Gpio = struct {
pub const enabled = Board.enabled;
pub const output: OutputTraits = .{ .name = config.gpio_buffer };
pub fn run(c: Ctx) void {
- if (comptime enabled) {
- Board.gpio(c.p, c.id, c.arg orelse "") catch |err|
- c.p.reportError(c.id, "gpio", err);
- } else unreachable;
+ Board.gpio(c.p, c.id, c.arg orelse "") catch |err|
+ c.p.reportError(c.id, "gpio", err);
}
};