Documentation ¶
Index ¶
- Constants
- Variables
- func CaptureCrash()
- func DefaultGitHubHost() string
- func FormatError(action string, err error) (ee error)
- func IsHttpsProtocol() bool
- func SanitizeProjectName(name string) string
- type AuthError
- type Branch
- func (b *Branch) IsMaster() bool
- func (b *Branch) IsRemote() bool
- func (b *Branch) LongName() string
- func (b *Branch) PushTarget(owner string, preferUpstream bool) (branch *Branch)
- func (b *Branch) RemoteName() string
- func (b *Branch) ShortName() string
- func (b *Branch) Upstream() (u *Branch, err error)
- type CIStatus
- type CIStatusResponse
- type Client
- func (client *Client) CommitPatch(project *Project, sha string) (patch io.ReadCloser, err error)
- func (client *Client) CreateIssue(project *Project, title, body string, labels []string) (issue *octokit.Issue, err error)
- func (client *Client) CreatePullRequest(project *Project, params map[string]interface{}) (pr *PullRequest, err error)
- func (client *Client) CreateRelease(project *Project, params octokit.ReleaseParams) (release *octokit.Release, err error)
- func (client *Client) CreateRepository(project *Project, description, homepage string, isPrivate bool) (repo *octokit.Repository, err error)
- func (client *Client) CurrentUser() (user *octokit.User, err error)
- func (client *Client) FetchCIStatus(project *Project, sha string) (status *CIStatusResponse, err error)
- func (client *Client) FindOrCreateToken(user, password, twoFactorCode string) (token string, err error)
- func (client *Client) ForkRepository(project *Project) (repo *Repository, err error)
- func (client *Client) GhLatestTagName() (tagName string, err error)
- func (client *Client) GistPatch(id string) (patch io.ReadCloser, err error)
- func (client *Client) IsRepositoryExist(project *Project) bool
- func (client *Client) Issues(project *Project) (issues []octokit.Issue, err error)
- func (client *Client) PullRequest(project *Project, id string) (pr *octokit.PullRequest, err error)
- func (client *Client) PullRequestPatch(project *Project, id string) (patch io.ReadCloser, err error)
- func (client *Client) Release(project *Project, tagName string) (release *octokit.Release, err error)
- func (client *Client) Releases(project *Project) (releases []octokit.Release, err error)
- func (client *Client) Repository(project *Project) (repo *octokit.Repository, err error)
- func (client *Client) UploadReleaseAsset(uploadUrl *url.URL, asset *os.File, contentType string) (err error)
- type Config
- func (c *Config) DefaultHost() (host *Host, err error)
- func (c *Config) DetectToken() string
- func (c *Config) Find(host string) *Host
- func (c *Config) PromptForHost(host string) (h *Host, err error)
- func (c *Config) PromptForOTP() string
- func (c *Config) PromptForPassword(host, user string) (pass string)
- func (c *Config) PromptForUser(host string) (user string)
- type Editor
- type GitHubRepo
- func (r *GitHubRepo) CurrentBranch() (branch *Branch, err error)
- func (r *GitHubRepo) CurrentProject() (project *Project, err error)
- func (r *GitHubRepo) MainProject() (project *Project, err error)
- func (r *GitHubRepo) MainRemote() (remote *Remote, err error)
- func (r *GitHubRepo) MasterBranch() (branch *Branch)
- func (r *GitHubRepo) OriginRemote() (remote *Remote, err error)
- func (r *GitHubRepo) RemoteBranchAndProject(owner string, preferUpstream bool) (branch *Branch, project *Project, err error)
- func (r *GitHubRepo) RemoteByName(name string) (*Remote, error)
- func (r *GitHubRepo) UpstreamProject() (project *Project, err error)
- type GithubHostError
- type Host
- type Project
- type PullRequest
- type Remote
- type Repository
- type RepositoryOwner
- type URL
Constants ¶
View Source
const ( GitHubHost string = "github.com" GitHubApiHost string = "api.github.com" OAuthAppURL string = "http://hub.github.com/" )
Variables ¶
View Source
var (
GitHubHostEnv = os.Getenv("GITHUB_HOST")
)
View Source
var (
OriginNamesInLookupOrder = []string{"upstream", "github", "origin"}
)
View Source
var UserAgent = "Hub " + version.Version
Functions ¶
func CaptureCrash ¶
func CaptureCrash()
func DefaultGitHubHost ¶
func DefaultGitHubHost() string
func FormatError ¶
func IsHttpsProtocol ¶
func IsHttpsProtocol() bool
func SanitizeProjectName ¶
Types ¶
type AuthError ¶
type AuthError struct {
Err error
}
func (*AuthError) IsDuplicatedTokenError ¶
func (*AuthError) IsRequired2FACodeError ¶
type Branch ¶
type Branch struct { Repo *GitHubRepo Name string }
func (*Branch) PushTarget ¶
func (*Branch) RemoteName ¶
type CIStatusResponse ¶
type Client ¶
type Client struct {
Host *Host
}
func NewClientWithHost ¶
func (*Client) CommitPatch ¶
func (*Client) CreateIssue ¶
func (*Client) CreatePullRequest ¶
func (client *Client) CreatePullRequest(project *Project, params map[string]interface{}) (pr *PullRequest, err error)
func (*Client) CreateRelease ¶
func (*Client) CreateRepository ¶
func (*Client) FetchCIStatus ¶
func (client *Client) FetchCIStatus(project *Project, sha string) (status *CIStatusResponse, err error)
func (*Client) FindOrCreateToken ¶
func (*Client) ForkRepository ¶
func (client *Client) ForkRepository(project *Project) (repo *Repository, err error)
func (*Client) GhLatestTagName ¶
func (*Client) GistPatch ¶
func (client *Client) GistPatch(id string) (patch io.ReadCloser, err error)
func (*Client) IsRepositoryExist ¶
func (*Client) PullRequest ¶
func (*Client) PullRequestPatch ¶
func (*Client) Repository ¶
func (client *Client) Repository(project *Project) (repo *octokit.Repository, err error)
type Config ¶
type Config struct {
Hosts []*Host `toml:"hosts"`
}
func CreateTestConfigs ¶
Public for testing purpose
func CurrentConfig ¶
func CurrentConfig() *Config
func (*Config) DefaultHost ¶
func (*Config) DetectToken ¶
func (*Config) PromptForOTP ¶
func (*Config) PromptForPassword ¶
func (*Config) PromptForUser ¶
type Editor ¶
type Editor struct { Program string Topic string File string Message string CS string // contains filtered or unexported fields }
func (*Editor) DeleteFile ¶
func (*Editor) EditTitleAndBody ¶
type GitHubRepo ¶
type GitHubRepo struct {
// contains filtered or unexported fields
}
func LocalRepo ¶
func LocalRepo() (repo *GitHubRepo, err error)
func (*GitHubRepo) CurrentBranch ¶
func (r *GitHubRepo) CurrentBranch() (branch *Branch, err error)
func (*GitHubRepo) CurrentProject ¶
func (r *GitHubRepo) CurrentProject() (project *Project, err error)
func (*GitHubRepo) MainProject ¶
func (r *GitHubRepo) MainProject() (project *Project, err error)
func (*GitHubRepo) MainRemote ¶
func (r *GitHubRepo) MainRemote() (remote *Remote, err error)
func (*GitHubRepo) MasterBranch ¶
func (r *GitHubRepo) MasterBranch() (branch *Branch)
func (*GitHubRepo) OriginRemote ¶
func (r *GitHubRepo) OriginRemote() (remote *Remote, err error)
func (*GitHubRepo) RemoteBranchAndProject ¶
func (*GitHubRepo) RemoteByName ¶
func (r *GitHubRepo) RemoteByName(name string) (*Remote, error)
func (*GitHubRepo) UpstreamProject ¶
func (r *GitHubRepo) UpstreamProject() (project *Project, err error)
type GithubHostError ¶
type GithubHostError struct {
// contains filtered or unexported fields
}
func (*GithubHostError) Error ¶
func (e *GithubHostError) Error() string
type Project ¶
func NewProject ¶
type PullRequest ¶
type PullRequest struct {
HTMLURL string `json:"html_url"`
}
type Repository ¶
type Repository struct { Name string `json:"name"` Parent *Repository `json:"parent"` Owner *RepositoryOwner `json:"owner"` }
type RepositoryOwner ¶
type RepositoryOwner struct {
Login string `json:"login"`
}
Click to show internal directories.
Click to hide internal directories.