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. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index a474147..73efa3e 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,14 @@ the common shapes, streaming into a `std.Io.Writer`. A refusal is `error.Refused` and `said()` holds the server's words. Its buffers are in the struct: no allocator. +`verbs.run(&fsys, args, stdin, stdout, stderr)` makes a program's own binary +the command line of the tree it dialled: `ls`, `read`, `write`, `ask`, +`follow`, `stat`, `help PATH` (the lines of the tree's `/README` whose first +word names PATH, a path over it or one under it, `` standing for any name, +with the lines indented under them) and `complete PREFIX` (a directory listing, a path +a line, for shell completion). Exit status 0, or 1 with the server's words on +stderr. See the top of `src/verbs.zig` for the five lines a program adds. + For a server, call `Server.receive()` after `push()`. A request borrows the input until `release()`. After releasing backend fids and canceling outstanding work, answer Tversion with `negotiate()`. Answer other requests with `reply()`. The -- cgit v1.3