29 lines
644 B
Go
29 lines
644 B
Go
package source
|
|
|
|
import (
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/gitea"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/github"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/gitlab"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/gogs"
|
|
)
|
|
|
|
type SourceControl interface {
|
|
RequestOpen()
|
|
RequestClose()
|
|
RequestUpdate()
|
|
}
|
|
|
|
func NewSourceControl(system, token string) SourceControl {
|
|
switch system {
|
|
case "github":
|
|
return github.NewGithub(token)
|
|
case "gitlab":
|
|
return gitlab.NewGitlab(token)
|
|
case "gitea":
|
|
return gitea.NewGitea(token)
|
|
case "gogs":
|
|
return gogs.NewGogs(token)
|
|
}
|
|
return nil
|
|
}
|