mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
Make the Kind
parsing simpler
This commit is contained in:
@ -36,15 +36,8 @@ pub const Kind = union(enum) {
|
||||
special: Special,
|
||||
|
||||
pub fn parse(key: []const u8) ?Kind {
|
||||
return kind: {
|
||||
const s = std.meta.stringToEnum(Special, key) orelse {
|
||||
const p = std.fmt.parseUnsigned(u8, key, 10) catch {
|
||||
break :kind null;
|
||||
};
|
||||
break :kind Kind{ .palette = p };
|
||||
};
|
||||
break :kind Kind{ .special = s };
|
||||
};
|
||||
if (std.meta.stringToEnum(Special, key)) |s| return Kind{ .special = s };
|
||||
return Kind{ .palette = std.fmt.parseUnsigned(u8, key, 10) catch return null };
|
||||
}
|
||||
|
||||
pub fn format(
|
||||
|
Reference in New Issue
Block a user