From 45a297a8e526094e8fce6e2c5c0fd89b381d1765 Mon Sep 17 00:00:00 2001 From: ewy Date: Tue, 14 Apr 2026 16:37:17 +0200 Subject: i have to commit at some point! --- indexers/pikdex/meta.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 indexers/pikdex/meta.go (limited to 'indexers/pikdex/meta.go') diff --git a/indexers/pikdex/meta.go b/indexers/pikdex/meta.go new file mode 100644 index 0000000..af1af93 --- /dev/null +++ b/indexers/pikdex/meta.go @@ -0,0 +1,27 @@ +package pikdex + +import ( + "strings" +) + +type MetaSetter func(s *SourceData, content string) + +var MetaFiles = map[string]MetaSetter{ + ".alias": func(s *SourceData, content string) { + split := strings.Split(content, "\n") + s.Aliases = make([]string, 0, len(split)) + for _, line := range split { + stripped := strip(line) + if stripped != "" { + s.Aliases = append(s.Aliases, stripped) + } + } + }, + ".icon": func(s *SourceData, content string) { + s.Icon = string([]rune(strip(content))[0:2]) + }, +} + +func strip(input string) string { + return strings.TrimSpace(input) +} -- cgit v1.3