noclip: improve help generation formatting

There are still quirks here. It's worth deciding if help descriptions
should be automatically hard-wrapped. Multi-line descriptions require
appropriate indentation after the first line. Long descriptions will
automatically be wrapped by the terminal.

The refactoring itch continues to grow.
This commit is contained in:
torque 2023-03-23 01:02:54 -07:00
parent af71064d7f
commit c870347f74
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk

View File

@ -304,9 +304,12 @@ pub fn CommandParser(
);
try writer.writeAll(data.help);
if (!std.mem.endsWith(u8, data.help, "\n")) {
try writer.writeAll("\n");
}
if (param_count.args > 0) {
try writer.writeAll("\n\nArguments:\n");
try writer.writeAll("\nArguments:\n");
for (args) |arg| {
defer arg.deinit(alloc);