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,
|
special: Special,
|
||||||
|
|
||||||
pub fn parse(key: []const u8) ?Kind {
|
pub fn parse(key: []const u8) ?Kind {
|
||||||
return kind: {
|
if (std.meta.stringToEnum(Special, key)) |s| return Kind{ .special = s };
|
||||||
const s = std.meta.stringToEnum(Special, key) orelse {
|
return Kind{ .palette = std.fmt.parseUnsigned(u8, key, 10) catch return null };
|
||||||
const p = std.fmt.parseUnsigned(u8, key, 10) catch {
|
|
||||||
break :kind null;
|
|
||||||
};
|
|
||||||
break :kind Kind{ .palette = p };
|
|
||||||
};
|
|
||||||
break :kind Kind{ .special = s };
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn format(
|
pub fn format(
|
||||||
|
Reference in New Issue
Block a user