about summary refs log tree commit diff stats
path: root/internal/config
diff options
context:
space:
mode:
authorAlan Pearce2025-03-20 13:20:16 +0100
committerAlan Pearce2025-03-20 13:20:16 +0100
commit7247322a386f065c643dc58f0ae5b57ad7ec1cc1 (patch)
tree3941fe279ffb36e88f1527aecb2ac06f9fe9aecf /internal/config
parent2705e97ce1cf7d6a399c5f0175c36562fdef3352 (diff)
downloadsearchix-7247322a386f065c643dc58f0ae5b57ad7ec1cc1.tar.lz
searchix-7247322a386f065c643dc58f0ae5b57ad7ec1cc1.tar.zst
searchix-7247322a386f065c643dc58f0ae5b57ad7ec1cc1.zip
feat: make list of source links dynamic
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/repository.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/config/repository.go b/internal/config/repository.go
index 52b255e..9d6ce98 100644
--- a/internal/config/repository.go
+++ b/internal/config/repository.go
@@ -2,6 +2,7 @@ package config
 
 import (
 	"fmt"
+	"net/url"
 	"strings"
 
 	"gitlab.com/tozd/go/errors"
@@ -21,6 +22,20 @@ type Repository struct {
 	Revision string `toml:"-"`
 }
 
+func (r *Repository) String() string {
+	switch r.Type {
+	case GitHub:
+		u, err := url.JoinPath("https://github.com/", r.Owner, r.Repo)
+		if err != nil {
+			panic(err)
+		}
+
+		return u
+	default:
+		panic("need repository string implementation for type " + r.Type.String())
+	}
+}
+
 func (f RepoType) String() string {
 	switch f {
 	case GitHub: