Revert "Fixed documentation generation in list-actions --docs command (#4974)"

This reverts commit f3d0c7c2ad, reversing
changes made to 4b77a1c71e.
This commit is contained in:
Mitchell Hashimoto
2025-02-11 12:55:30 -08:00
parent adb187685b
commit f8b547f92e
4 changed files with 69 additions and 114 deletions

View File

@@ -2,7 +2,7 @@ const std = @import("std");
const args = @import("args.zig");
const Action = @import("action.zig").Action;
const Allocator = std.mem.Allocator;
const helpgen_actions = @import("../helpgen_actions.zig");
const help_strings = @import("help_strings");
pub const Options = struct {
/// If `true`, print out documentation about the action associated with the
@@ -38,7 +38,19 @@ pub fn run(alloc: Allocator) !u8 {
}
const stdout = std.io.getStdOut().writer();
try helpgen_actions.generate(stdout, .plaintext, std.heap.page_allocator);
const info = @typeInfo(help_strings.KeybindAction);
inline for (info.Struct.decls) |field| {
try stdout.print("{s}", .{field.name});
if (opts.docs) {
try stdout.print(":\n", .{});
var iter = std.mem.splitScalar(u8, std.mem.trimRight(u8, @field(help_strings.KeybindAction, field.name), &std.ascii.whitespace), '\n');
while (iter.next()) |line| {
try stdout.print(" {s}\n", .{line});
}
} else {
try stdout.print("\n", .{});
}
}
return 0;
}