mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-08 10:56:34 +00:00
rewrite generate_help for personal style
- Output to stdin instead of a file - Less nesting - Utilize ranged for loops instead of while loops - Eliminate unnecessary state tracking - Put help in a struct
This commit is contained in:
@@ -69,6 +69,21 @@ pub const Action = enum {
|
||||
.@"list-colors" => try list_colors.run(alloc),
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the filename associated with an action. This is a relative
|
||||
/// path from the root src/ directory.
|
||||
pub fn file(comptime self: Action) []const u8 {
|
||||
comptime {
|
||||
const filename = filename: {
|
||||
const tag = @tagName(self);
|
||||
var filename: [tag.len]u8 = undefined;
|
||||
_ = std.mem.replace(u8, tag, "-", "_", &filename);
|
||||
break :filename &filename;
|
||||
};
|
||||
|
||||
return "cli/" ++ filename ++ ".zig";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
test "parse action none" {
|
||||
|
Reference in New Issue
Block a user