diff options
| author | Henrique Dias <hacdias@gmail.com> | 2023-11-07 20:45:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-07 11:45:45 -0800 |
| commit | 550450a3b1e07a70a506d872137ea43774d2c5e0 (patch) | |
| tree | d75e2174eeb6ba9197fbf70ce97f3567a6322859 /handler.go | |
| parent | 35e7777d1a11bff5e192aaae3145685a6a2aec60 (diff) | |
| download | sally-550450a3b1e07a70a506d872137ea43774d2c5e0.tar.gz | |
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.
Diffstat (limited to '')
| -rw-r--r-- | handler.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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 { |