initial commit

This commit is contained in:
2025-06-19 16:48:22 +01:00
commit e622234993
17 changed files with 738 additions and 0 deletions

19
filter.go Normal file
View File

@@ -0,0 +1,19 @@
package main
import (
"strings"
)
// filterFunc returns a function that filters templates based on the specified filter type.
func filterFunc(templates []string, filterType string) func(input string, index int) bool {
switch filterType {
case "contains":
return func(input string, index int) bool {
return strings.Contains(strings.ToLower(templates[index]), strings.ToLower(input))
}
default:
return func(input string, index int) bool {
return strings.HasPrefix(strings.ToLower(templates[index]), strings.ToLower(input))
}
}
}