diff options
Diffstat (limited to 'internal/server/templates.go')
-rw-r--r-- | internal/server/templates.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/server/templates.go b/internal/server/templates.go index 3d45167..8967599 100644 --- a/internal/server/templates.go +++ b/internal/server/templates.go @@ -8,6 +8,7 @@ import ( "log/slog" "path" "searchix/frontend" + "searchix/internal/config" "searchix/internal/nix" "strings" @@ -33,6 +34,16 @@ var templateFuncs = template.FuncMap{ return template.HTML(out.String()) // #nosec G203 }, + "sourceNameAndType": func(source config.Source) (string, error) { + switch source.Importer { + case config.Options: + return source.Name + " " + source.Importer.String(), nil + case config.Packages: + return source.Name, nil + default: + return "", errors.Errorf("unknown source importer type %s", source.Importer.String()) + } + }, "sourceName": func(input string) string { switch input { case "nixos": |