package source import ( "context" "errors" "git.unistack.org/unistack-org/pkgdash/internal/configcli" "git.unistack.org/unistack-org/pkgdash/internal/modules" "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" ) var ( ErrPRExist = errors.New("Pull request exists") ErrPRNotExist = errors.New("Pull request does not exist") ) type SourceControl interface { RequestOpen(ctx context.Context, cfg *configcli.Config, branch string, path string, mod modules.Update) error RequestClose(ctx context.Context, cfg *configcli.Config, branch string, path string) error RequestUpdate(ctx context.Context, cfg *configcli.Config, branch string, path string, mod modules.Update) error } 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 }