diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 09:50:21 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 12d387e4a03204a2b6d0c51633e228063e883fad (patch) | |
| tree | 9d1af954cacbbc90f60bd85499088865c786f993 /src/ninep/tree.zig | |
| parent | f5eaddb2cf28a9b72d5dd5b3b10502a316d4de85 (diff) | |
| download | pardes-12d387e4a03204a2b6d0c51633e228063e883fad.tar.gz pardes-12d387e4a03204a2b6d0c51633e228063e883fad.zip | |
A root commands file lists every builtin, its argument and which ctl takes it
A script could learn the builtin words only from source or the Help
window. /commands is generated from the registry: one line per builtin,
Word or Word arg, then root or pane for the ctl that takes it, so it is
always this build's own list.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/tree.zig')
| -rw-r--r-- | src/ninep/tree.zig | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 13dfb0cf..53472a60 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -176,6 +176,7 @@ pub const TopFile = enum(u4) { new, focus, ctl, + commands, pub fn fileName(f: TopFile) []const u8 { return if (f == .root) "/" else @tagName(f); @@ -185,7 +186,7 @@ pub const TopFile = enum(u4) { return switch (f) { .root, .pane => 0o755, .look, .exec, .log, .focus, .ctl => 0o666, - .README, .index, .status, .screen, .listeners, .new => 0o444, + .README, .index, .status, .screen, .listeners, .new, .commands => 0o444, }; } @@ -447,6 +448,7 @@ fn topSize(p: *Pardes, f: TopFile) u64 { .log => events.logLen(&p.fs.log), .listeners => screen.listenersLen(p), .ctl => ctl.rootLen(p), + .commands => ctl.commandsLen(), .focus => focus: { const pn = p.panes[p.active] orelse break :focus 0; var digits: [16]u8 = undefined; @@ -525,7 +527,7 @@ fn readdir(p: *Pardes, req: Req, target: Target) Reply { } if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, fs.os_root, true, "os"); // After the first ten, which older clients list by position. - inline for (.{ TopFile.focus, TopFile.ctl }) |t| { + inline for (.{ TopFile.focus, TopFile.ctl, TopFile.commands }) |t| { if (skip > 0) skip -= 1 else stageDirent(out, p.gpa, @intFromEnum(t), t.dir(), t.fileName()); } sources.stage(p, out, "", &skip); @@ -719,6 +721,7 @@ fn read(p: *Pardes, req: Req, target: Target) Reply { .listeners => screen.readListeners(p, req), .focus => ctl.readFocus(p, req), .ctl => ctl.readRoot(p, req), + .commands => ctl.readCommands(p, req), // The serial the open handed this fid, so that two reads of one // fid answer the same pane: the read observes, the open acted. .new => serial: { |
