-
Notifications
You must be signed in to change notification settings - Fork 103
/
detect.go
25 lines (23 loc) · 919 Bytes
/
detect.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package hosting
import (
"github.com/git-town/git-town/v14/src/config/configdomain"
"github.com/git-town/git-town/v14/src/git/giturl"
"github.com/git-town/git-town/v14/src/hosting/bitbucket"
"github.com/git-town/git-town/v14/src/hosting/gitea"
"github.com/git-town/git-town/v14/src/hosting/github"
"github.com/git-town/git-town/v14/src/hosting/gitlab"
)
func Detect(originURL *giturl.Parts, hostingPlatform configdomain.HostingPlatform) configdomain.HostingPlatform {
switch {
case bitbucket.Detect(originURL, hostingPlatform):
return configdomain.HostingPlatformBitbucket
case gitea.Detect(originURL, hostingPlatform):
return configdomain.HostingPlatformGitea
case github.Detect(originURL, hostingPlatform):
return configdomain.HostingPlatformGitHub
case gitlab.Detect(originURL, hostingPlatform):
return configdomain.HostingPlatformGitLab
default:
return configdomain.HostingPlatformNone
}
}