diff --git a/README.md b/README.md index b66138d..0ada845 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,8 @@ paths: vcs required if ambiguous - If the version control system cannot be inferred (e.g. for Bitbucket or a custom domain), then this specifies the version control system as it would appear in go-import meta tag. This can be one of git, hg, svn, or bzr. + If the version control system cannot be inferred (e.g. for Bitbucket or a custom domain), then this specifies the version control system as it would appear in go-import meta tag. This can be one of git, hg, svn, or bzr.
+ You can also use gitlab/github/bitbucket which will be translated to git and will add the default disaplay diff --git a/handler.go b/handler.go index 8b7738d..df8455b 100644 --- a/handler.go +++ b/handler.go @@ -71,15 +71,23 @@ func newHandler(config []byte) (*handler, error) { switch { case e.Display != "": // Already filled in. + case pc.vcs == "github": + fallthrough + case pc.vcs == "gitlab": + pc.vcs = "git" + fallthrough case strings.HasPrefix(e.Repo, "https://github.com/"): pc.display = fmt.Sprintf("%v %v/tree/master{/dir} %v/blob/master{/dir}/{file}#L{line}", e.Repo, e.Repo, e.Repo) + case pc.vcs == "bitbucket": + pc.vcs = "git" + fallthrough case strings.HasPrefix(e.Repo, "https://bitbucket.org"): pc.display = fmt.Sprintf("%v %v/src/default{/dir} %v/src/default{/dir}/{file}#{file}-{line}", e.Repo, e.Repo, e.Repo) } switch { - case e.VCS != "": + case pc.vcs != "": // Already filled in. - if e.VCS != "bzr" && e.VCS != "git" && e.VCS != "hg" && e.VCS != "svn" { + if pc.vcs != "bzr" && pc.vcs != "git" && pc.vcs != "hg" && pc.vcs != "svn" { return nil, fmt.Errorf("configuration for %v: unknown VCS %s", path, e.VCS) } case strings.HasPrefix(e.Repo, "https://github.com/"):