diff options
| -rw-r--r-- | docs/typ/style.typ | 6 | ||||
| -rw-r--r-- | runtime/main.zig | 6 | ||||
| -rw-r--r-- | test/process/cli.zig | 8 |
3 files changed, 16 insertions, 4 deletions
diff --git a/docs/typ/style.typ b/docs/typ/style.typ index bf005c63..1b172dc8 100644 --- a/docs/typ/style.typ +++ b/docs/typ/style.typ @@ -188,7 +188,8 @@ /// Every builtin of either build, written by `zig build builtins-json` /// from the registry and the Help rows (core/builtins_json.zig), a file per /// build: name, leader, also (Help's other shortcuts), arg, scope, setting, -/// choices, doc, and for a shipped addon's word its addon first. Merged here, each with `platforms`: "both", "tui" (the +/// choices, doc (its summary), text (its whole documentation, a line a +/// paragraph), and for a shipped addon's word its addon first. Merged here, each with `platforms`: "both", "tui" (the /// terminal only) or "gui" (the window only). #let builtin-data = { let tui = json("builtins-tui.json") @@ -426,7 +427,8 @@ #if "addon" in b [#emph[the #raw(b.addon) addon's] · ] #if keys.len() > 0 [#keys.join([, ]) · ] #if b.choices != none [#raw(b.choices.replace(", ", "|")) · ] else if b.arg [takes an argument · ] - #prose(b.doc) + // its whole documentation (`text`), a paragraph a line, as Help shows it + #b.text.split("\n").map(prose).join(parbreak()) ] /// The glossary: everyday words first, then the groups, then internals, diff --git a/runtime/main.zig b/runtime/main.zig index 5cdf5ee0..8558e25f 100644 --- a/runtime/main.zig +++ b/runtime/main.zig @@ -879,6 +879,12 @@ fn help(init: std.process.Init, out: *std.Io.Writer, args: []const []const u8, s writeLeaf(out, c) catch {}; return 0; } + // A builtin of this build: what `Help <Word>` shows, its whole + // documentation (builtins.registry.doc) and what the list does not say. + if (std.meta.stringToEnum(pardes.builtins.registry.Builtin(), what)) |b| { + pardes.panes.Output.writeWordHelp(out, b) catch {}; + return 0; + } const t = readTree(init, session); const commands = t.read(arena, "commands") catch ""; if (Word.find(commands, what)) |w| { diff --git a/test/process/cli.zig b/test/process/cli.zig index 083ba368..bf3716a8 100644 --- a/test/process/cli.zig +++ b/test/process/cli.zig @@ -52,8 +52,12 @@ fn helpOffline(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try expectRan(try pardes(a, exe, root, &.{ "help", "attach" }), 0, "\n pardes attach box:notes ", "help attach"); try expectRan(try pardes(a, exe, root, &.{ "help", "new" }), 0, " --detach[=NAME]", "help new"); try expectRan(try pardes(a, exe, root, &.{ "help", "fs" }), 0, "usage: fs ls [PATH]", "help fs"); - try expectRan(try pardes(a, exe, root, &.{ "help", "Newcol" }), 0, "Newcol (the root ctl; SPC c n; column)", "help Newcol"); - try expectRan(try pardes(a, exe, root, &.{ "help", "Save" }), 0, "pardes do Save", "help Save"); + // A builtin: what `Help <Word>` shows, its whole documentation. + const newcol = try pardes(a, exe, root, &.{ "help", "Newcol" }); + try expectRan(newcol, 0, "SPC c n Newcol", "help Newcol"); + try expectRan(newcol, 0, "\nacts on: the session (over 9P, the root ctl)\n", "help Newcol"); + try expectRan(try pardes(a, exe, root, &.{ "help", "Save" }), 0, "\nfrom a shell: pardes do Save [ARG]\n", "help Save"); + try expectRan(try pardes(a, exe, root, &.{ "help", "Diff" }), 0, "`Diff <hash>`", "help Diff"); try expectRan(try pardes(a, exe, root, &.{ "help", "pane/3/addr" }), 0, "pane/<n>/ name body tag", "help pane/3/addr"); try expectRan(try pardes(a, exe, root, &.{ "help", "nowhere" }), 1, "is not a command, a builtin", "help nowhere"); const all = try pardes(a, exe, root, &.{ "help", "--all" }); |
