From 550450a3b1e07a70a506d872137ea43774d2c5e0 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 7 Nov 2023 20:45:45 +0100 Subject: feat: add support for other vcs systems (#128) Adds support to other VCS systems as per the specification. Defaults to `git` for backwards compatibility. Renames the internally used `.GitURL` to `.RepoURL` for clarity. --- handler.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'handler.go') diff --git a/handler.go b/handler.go index f636359..ccf8d27 100644 --- a/handler.go +++ b/handler.go @@ -49,7 +49,8 @@ func CreateHandler(config *Config) http.Handler { Desc: pkg.Desc, ModulePath: modulePath, DocURL: docURL, - GitURL: pkg.Repo, + VCS: pkg.VCS, + RepoURL: pkg.Repo, } pkgs = append(pkgs, pkg) @@ -90,8 +91,11 @@ type sallyPackage struct { // URL at which documentation for the package can be found. DocURL string - // URL at which the Git repository is hosted. - GitURL string + // Version control system used by the package. + VCS string + + // URL at which the repository is hosted. + RepoURL string } type indexHandler struct { @@ -169,11 +173,13 @@ func (h *packageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { err := packageTemplate.Execute(w, struct { ModulePath string - GitURL string + VCS string + RepoURL string DocURL string }{ ModulePath: h.Pkg.ModulePath, - GitURL: h.Pkg.GitURL, + VCS: h.Pkg.VCS, + RepoURL: h.Pkg.RepoURL, DocURL: h.Pkg.DocURL + relPath, }) if err != nil { -- cgit v1.2.3