diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/repository.go | 15 |
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: |