diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 02:03:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | d95ee38b80b0260c633612bdd3abb414ddd46a23 (patch) | |
| tree | 93bd64beac4e489b058d09706e341b26958e8756 /src/host | |
| parent | 5c306e3dce3535dee1f6670076d537e05abff0d1 (diff) | |
| download | sketchbook-d95ee38b80b0260c633612bdd3abb414ddd46a23.tar.gz sketchbook-d95ee38b80b0260c633612bdd3abb414ddd46a23.zip | |
README: the 9P controls rewritten around the tree; the Build API's cloud9
"Local 9P controls" was a socket path, plan9port `9p` lines and a poll
of status for a screenshot. Now it says what a running sketch is: a
tree that describes itself (README, commands, made from the tables), how
it is found (posted as sketchbook/<name> by a run in a window, --9p NAME
or a socket path), `fs VERB PATH` in every executable and the generic
host, answering with the sketch closed from the save or the defaults;
a table of the files; how the State maps to files (rows of numbers one
file, arrays of arrays and of structs directories, drat-meout's notes as
the example; a value read as it was at the open); and an agent driving
drat-meout: start it, help, a console line, read state, await by reading
in a loop, a live click, one read for a screenshot, a refused write in
words, help of one file, quit, and a read with it closed. The ctl
paragraph says the 4096-byte write, errors as their names and what each
open pins; the trace examples use fs. The console bullet says help VERB
and set of an array. The Build API lists sb.modules.cloud9. --help's
--9p row and usage line say NAME|/SOCKET and fs.
Tests: the session in the manual was run against the drat-meout copy,
headless, posted under a scratch runtime directory.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/host')
| -rw-r--r-- | src/host/root.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/host/root.zig b/src/host/root.zig index 77fd14e..1edd9a4 100644 --- a/src/host/root.zig +++ b/src/host/root.zig @@ -105,7 +105,7 @@ pub fn main(init: std.process.Init, linked: ?abi.Sketch) !void { /// `main` sets what each one means) and prints `--help`. const Flag = enum { @"9p", state, headless, script, fresh, @"timing-marker", @"profile-gpu", console, define, @"export", fps, frames, size, help }; const flags = std.enums.EnumArray(Flag, struct { arg: []const u8 = "", doc: []const u8 }).init(.{ - .@"9p" = .{ .arg = "SOCKET", .doc = "local 9P controls: ctl, status, log, screen.png" }, + .@"9p" = .{ .arg = "NAME|/SOCKET", .doc = "the 9P tree (README, ctl, state/, screen.png...), posted as sketchbook/NAME\n(a run in a window posts its own name), or at a socket path" }, .state = .{ .arg = "FILE", .doc = "the save, one file: FILE, or FILE.xitdb for a FILE.state (where a\nstate file from before is imported from, once); default:\n$XDG_DATA_HOME/<name>/<name>.xitdb, sketch.xitdb for --script, --export" }, .headless = .{ .doc = "offscreen video, silent audio, no vsync" }, .script = .{ .arg = "FILE", .doc = "play a script instead of reading devices" }, @@ -125,11 +125,11 @@ const flags = std.enums.EnumArray(Flag, struct { arg: []const u8 = "", doc: []co const usage = blk: { @setEvalBranchQuota(100_000); const pad: [23]u8 = @splat(' '); - var text: []const u8 = "usage: sketchbook [options] [LIBRARY]\n"; + var text: []const u8 = "usage: sketchbook [options] [LIBRARY] [fs VERB [PATH [WORDS...]]]\n"; for (std.enums.values(Flag)) |flag| { const f = flags.get(flag); const head = " --" ++ @tagName(flag) ++ (if (f.arg.len > 0) " " ++ f.arg else ""); - text = text ++ head ++ pad[head.len..]; + text = text ++ head ++ pad[@min(head.len, pad.len)..]; var lines = std.mem.splitScalar(u8, f.doc, '\n'); text = text ++ lines.first() ++ "\n"; while (lines.next()) |more| text = text ++ pad ++ more ++ "\n"; |
