From 7247322a386f065c643dc58f0ae5b57ad7ec1cc1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 20 Mar 2025 13:20:16 +0100 Subject: feat: make list of source links dynamic --- internal/config/repository.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'internal/config') 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: -- cgit 1.4.1