add --lang and --theme options

This commit is contained in:
CJ van den Berg 2024-02-20 18:58:49 +01:00
parent 0b0200aecc
commit 53b6895b02
4 changed files with 52 additions and 4 deletions

View file

@ -12,6 +12,13 @@ injections: ?[:0]const u8,
first_line_matches: ?FirstLineMatch = null,
comment: []const u8,
pub fn get_by_name(name: []const u8) ?*const FileType {
for (file_types) |*file_type|
if (std.mem.eql(u8, file_type.name, name))
return file_type;
return null;
}
pub fn guess(file_path: ?[]const u8, content: []const u8) ?*const FileType {
if (guess_first_line(content)) |ft| return ft;
for (file_types) |*file_type|