From b44d970c121a65e1f9de04fee600a3b495fb6c96 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 00:48:48 -0300 Subject: verbs: the fs verbs as a function a program calls with a dialled tree The user wants each app's binary to drive the tree it serves ("the cli should be like a living documentation, similar to 9p"): `pardes fs read pane/3/body`, `drat-meout fs read state/scene`. verbs.run(&fsys, args, stdin, stdout, stderr) is that command line, added in five lines (the top of the file shows them): ls, read, write (the words and a newline, or stdin a write a read of it, as 9p write), ask (write then read one open), follow (ask, or read: each answer flushed as it comes), stat (Plan 9's mode letters, length, uid, gid, mtime, name), help and complete. Exit status 0, or 1 with the server's own words on stderr; a verb not known is the usage. help PATH reads the tree's /README: a line is about the file its first word names, a path from the root with a leading or trailing slash or a comma dropped and standing for one name, and about everything under it; lines after it indented deeper go with it. pardes's src/fs-help.txt, 9proc's and 9agents' READMEs are in that shape already; sketchbook's control tree serves none yet and would write one so. complete PREFIX lists the directory PREFIX ends in, the names it starts, as paths, a trailing slash on a directory. Tests drive run() against TestTree in process: listings, reads, stats, completion, refusals in the server's words, stdin writes, ask, help including the line matcher on pardes's and 9proc's shapes, follow of three held chunks and a hangup mid-read, and the usage. Also run by hand from a scratch program of those five lines against a 9proc-demo on a Unix socket. --- src/root.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/root.zig') diff --git a/src/root.zig b/src/root.zig index 8dc6132..629396c 100644 --- a/src/root.zig +++ b/src/root.zig @@ -53,9 +53,11 @@ pub const transport = @import("transport.zig"); pub const serve = @import("serve.zig"); pub const post = @import("post.zig"); pub const Fsys = @import("Fsys.zig"); +pub const verbs = @import("verbs.zig"); test { _ = @import("post.zig"); _ = @import("Fsys.zig"); + _ = @import("verbs.zig"); } pub const Quic = @import("quic.zig").Quic; test { -- cgit v1.3