diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 02:08:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 2241a5d2dab43ee1effd17bf662597edca781977 (patch) | |
| tree | 598bf7bf010d778df5b6b92ee4a0719d90c41baa /src/host/Console.zig | |
| parent | d95ee38b80b0260c633612bdd3abb414ddd46a23 (diff) | |
| download | sketchbook-2241a5d2dab43ee1effd17bf662597edca781977.tar.gz sketchbook-2241a5d2dab43ee1effd17bf662597edca781977.zip | |
console help: the verbs' names, so the sketch's help fits the log under them
help printed the rows with their arguments, four lines of the log's
five, and drat-meout's own help pushed the first out. Now it is the
names (two lines), help VERB says a verb's arguments and what it does,
and the sketch's lines follow.
Tests: test-timing and test-control, 49/49 steps, 30/30 tests; live in
the drat-meout copy over fs, `help` leaves the sketch's two lines and
its own in the log.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/host/Console.zig')
| -rw-r--r-- | src/host/Console.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/host/Console.zig b/src/host/Console.zig index b1915bb..6fdfba4 100644 --- a/src/host/Console.zig +++ b/src/host/Console.zig @@ -224,15 +224,17 @@ pub fn execute(self: *Console, host: *Host, line: []const u8, now: u64) ![]const } var buf: [Line.width + 3]u8 = undefined; var w: std.Io.Writer = .fixed(&buf); + // Names only, so the sketch's help fits the log below them. + w.writeAll("help VERB says more:") catch {}; for (std.enums.values(Verb)) |v| { - if (w.end + @tagName(v).len + verbs.get(v).args.len + 3 > Line.width) { + if (w.end + @tagName(v).len + 1 > Line.width) { self.log(w.buffered()); w.end = 0; } - w.print("{s}{t}{s}{s}", .{ if (w.end == 0) "" else " | ", v, if (verbs.get(v).args.len == 0) "" else " ", verbs.get(v).args }) catch {}; + w.print(" {t}", .{v}) catch {}; } self.log(w.buffered()); - if (host.forward(self, line, now) == .unknown) self.log("help VERB says what one does. Backtick hides the console. Tab completes."); + if (host.forward(self, line, now) == .unknown) self.log("Backtick hides the console. Tab completes."); }, .overlay => { const name = arg orelse return error.ExpectedOverlay; |
