mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Generate help strings for keybind actions.
This commit is contained in:
@ -6,6 +6,7 @@ const std = @import("std");
|
||||
const ziglyph = @import("ziglyph");
|
||||
const Config = @import("config/Config.zig");
|
||||
const Action = @import("cli/action.zig").Action;
|
||||
const KeybindAction = @import("input/Binding.zig").Action;
|
||||
|
||||
pub fn main() !void {
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
@ -20,6 +21,7 @@ pub fn main() !void {
|
||||
|
||||
try genConfig(alloc, stdout);
|
||||
try genActions(alloc, stdout);
|
||||
try genKeybindActions(alloc, stdout);
|
||||
}
|
||||
|
||||
fn genConfig(alloc: std.mem.Allocator, writer: anytype) !void {
|
||||
@ -114,6 +116,25 @@ fn genActions(alloc: std.mem.Allocator, writer: anytype) !void {
|
||||
try writer.writeAll("};\n");
|
||||
}
|
||||
|
||||
fn genKeybindActions(alloc: std.mem.Allocator, writer: anytype) !void {
|
||||
var ast = try std.zig.Ast.parse(alloc, @embedFile("input/Binding.zig"), .zig);
|
||||
defer ast.deinit(alloc);
|
||||
|
||||
try writer.writeAll(
|
||||
\\/// keybind actions help
|
||||
\\pub const KeybindAction = struct {
|
||||
\\
|
||||
\\
|
||||
);
|
||||
|
||||
inline for (@typeInfo(KeybindAction).Union.fields) |field| {
|
||||
if (field.name[0] == '_') continue;
|
||||
try genConfigField(alloc, writer, ast, field.name);
|
||||
}
|
||||
|
||||
try writer.writeAll("};\n");
|
||||
}
|
||||
|
||||
fn extractDocComments(
|
||||
alloc: std.mem.Allocator,
|
||||
ast: std.zig.Ast,
|
||||
|
Reference in New Issue
Block a user