From 05e61978906a08132c4340a5f9ae518134dd0fa9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 May 2024 14:06:06 +0200 Subject: feat: support searching packages --- internal/server/templates.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'internal/server/templates.go') 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": -- cgit 1.4.1