mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-04 21:04:41 +00:00
Refactor keybinding actions reference generation
This commit is contained in:
@@ -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 help_strings = @import("help_strings");
|
||||
const helpgen_actions = @import("../input/helpgen_actions.zig");
|
||||
|
||||
pub const Options = struct {
|
||||
/// If `true`, print out documentation about the action associated with the
|
||||
@@ -38,19 +38,7 @@ pub fn run(alloc: Allocator) !u8 {
|
||||
}
|
||||
|
||||
const stdout = std.io.getStdOut().writer();
|
||||
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", .{});
|
||||
}
|
||||
}
|
||||
try helpgen_actions.generate(stdout, .plaintext, opts.docs, std.heap.page_allocator);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user