mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 18:06:33 +00:00
cli: positional arguments are invalid when parsing configuration
This commit is contained in:
@@ -46,6 +46,8 @@ pub const Location = union(enum) {
|
||||
line: usize,
|
||||
},
|
||||
|
||||
pub const Key = @typeInfo(Location).Union.tag_type.?;
|
||||
|
||||
pub fn fromIter(iter: anytype) Location {
|
||||
const Iter = t: {
|
||||
const T = @TypeOf(iter);
|
||||
@@ -121,4 +123,17 @@ pub const DiagnosticList = struct {
|
||||
pub fn items(self: *const DiagnosticList) []const Diagnostic {
|
||||
return self.list.items;
|
||||
}
|
||||
|
||||
/// Returns true if there are any diagnostics for the given
|
||||
/// location type.
|
||||
pub fn containsLocation(
|
||||
self: *const DiagnosticList,
|
||||
location: Location.Key,
|
||||
) bool {
|
||||
for (self.list.items) |diag| {
|
||||
if (diag.location == location) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user