Documentation ¶
Index ¶
- Constants
- func ConvertToValidBranchName(name string) string
- func FindGitConfigDir(dir string) (string, string, error)
- func GitAdd(dir string, args ...string) error
- func GitClone(url string, directory string) error
- func GitCmd(dir string, args ...string) error
- func GitCommit(dir string, message string) error
- func GitCommitIfChanges(dir string, message string) error
- func GitCreatePushURL(cloneURL string, userAuth *auth.UserAuth) (string, error)
- func GitInit(dir string) error
- func GitPush(dir string) error
- func GitRepoName(org, repoName string) string
- func GitStatus(dir string) error
- func HasChanges(dir string) (bool, error)
- func PickOrganisation(provider GitProvider, userName string) (string, error)
- func SetRemoteURL(dir string, name string, gitURL string) error
- type CreateRepoData
- type GitHubProvider
- func (p *GitHubProvider) CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error)
- func (p *GitHubProvider) CreateRepository(org string, name string, private bool) (*GitRepository, error)
- func (p *GitHubProvider) ForkRepository(originalOrg string, name string, destinationOrg string) (*GitRepository, error)
- func (p *GitHubProvider) IsGitHub() bool
- func (p *GitHubProvider) ListOrganisations() ([]GitOrganisation, error)
- func (p *GitHubProvider) RenameRepository(org string, name string, newName string) (*GitRepository, error)
- func (p *GitHubProvider) ValidateRepositoryName(org string, name string) error
- type GitOrganisation
- type GitProvider
- type GitPullRequest
- type GitPullRequestArguments
- type GitRepository
- type GitRepositoryInfo
Constants ¶
View Source
const (
GitHubHost = "github.com"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertToValidBranchName ¶
ConvertToValidBranchName converts the given branch name into a valid git branch string replacing any dodgy characters
func FindGitConfigDir ¶
FindGitConfigDir tries to find the `.git` directory either in the current directory or in parent directories
func GitCommitIfChanges ¶
func GitCreatePushURL ¶
GitCreatePushURL creates the git repository URL with the username and password encoded for HTTPS based URLs
func GitRepoName ¶
func HasChanges ¶
func PickOrganisation ¶
func PickOrganisation(provider GitProvider, userName string) (string, error)
PickOrganisation picks an organisations login if there is one available
Types ¶
type CreateRepoData ¶
type CreateRepoData struct { Organisation string RepoName string FullName string PrivateRepo bool User *auth.UserAuth GitProvider GitProvider }
func PickNewGitRepository ¶
func PickNewGitRepository(out io.Writer, authConfigSvc auth.AuthConfigService, defaultRepoName string) (*CreateRepoData, error)
func (*CreateRepoData) CreateRepository ¶
func (d *CreateRepoData) CreateRepository() (*GitRepository, error)
type GitHubProvider ¶
type GitHubProvider struct { Username string Client *github.Client Context context.Context Server auth.AuthServer User auth.UserAuth }
func (*GitHubProvider) CreatePullRequest ¶
func (p *GitHubProvider) CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error)
func (*GitHubProvider) CreateRepository ¶
func (p *GitHubProvider) CreateRepository(org string, name string, private bool) (*GitRepository, error)
func (*GitHubProvider) ForkRepository ¶
func (p *GitHubProvider) ForkRepository(originalOrg string, name string, destinationOrg string) (*GitRepository, error)
func (*GitHubProvider) IsGitHub ¶
func (p *GitHubProvider) IsGitHub() bool
func (*GitHubProvider) ListOrganisations ¶
func (p *GitHubProvider) ListOrganisations() ([]GitOrganisation, error)
func (*GitHubProvider) RenameRepository ¶
func (p *GitHubProvider) RenameRepository(org string, name string, newName string) (*GitRepository, error)
func (*GitHubProvider) ValidateRepositoryName ¶
func (p *GitHubProvider) ValidateRepositoryName(org string, name string) error
type GitOrganisation ¶
type GitOrganisation struct {
Login string
}
type GitProvider ¶
type GitProvider interface { ListOrganisations() ([]GitOrganisation, error) CreateRepository(org string, name string, private bool) (*GitRepository, error) ForkRepository(originalOrg string, name string, destinationOrg string) (*GitRepository, error) RenameRepository(org string, name string, newName string) (*GitRepository, error) ValidateRepositoryName(org string, name string) error CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error) IsGitHub() bool }
func CreateProvider ¶
func CreateProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)
func NewGitHubProvider ¶
func NewGitHubProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)
type GitPullRequest ¶
type GitPullRequest struct {
URL string
}
type GitPullRequestArguments ¶
type GitRepository ¶
type GitRepositoryInfo ¶
type GitRepositoryInfo struct { URL string Scheme string Host string Organisation string Name string }
func ParseGitURL ¶
func ParseGitURL(text string) (*GitRepositoryInfo, error)
ParseGitURL attempts to parse the given text as a URL or git URL-like string to determine the protocol, host, organisation and name
func (*GitRepositoryInfo) CreateProviderForUser ¶
func (i *GitRepositoryInfo) CreateProviderForUser(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)
func (*GitRepositoryInfo) IsGitHub ¶
func (i *GitRepositoryInfo) IsGitHub() bool
func (*GitRepositoryInfo) PickOrCreateProvider ¶
func (i *GitRepositoryInfo) PickOrCreateProvider(authConfigSvc auth.AuthConfigService) (GitProvider, error)
Click to show internal directories.
Click to hide internal directories.