all repos — searchix @ 7247322a386f065c643dc58f0ae5b57ad7ec1cc1

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: make list of source links dynamic

Alan Pearce
commit

7247322a386f065c643dc58f0ae5b57ad7ec1cc1

parent

2705e97ce1cf7d6a399c5f0175c36562fdef3352

1 file changed, 15 insertions(+), 0 deletions(-)

changed files
M internal/config/repository.gointernal/config/repository.go
@@ -2,6 +2,7 @@ package config
import ( "fmt" + "net/url" "strings" "gitlab.com/tozd/go/errors"
@@ -19,6 +20,20 @@ Type RepoType `toml:"" default:"github" comment:"Currently only 'github' is supported."`
Owner string Repo string 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 {