|
|
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 <anything> 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.
|