Documentation
¶
Index ¶
- func CreateIssue(login *config.Login, repoOwner, repoName string, opts gitea.CreateIssueOption) error
- func CreateLogin(...) error
- func CreateMilestone(login *config.Login, repoOwner, repoName, title, description string, ...) error
- func CreatePull(ctx *context.TeaContext, base, head string, allowMaintainerEdits bool, ...) (err error)
- func CreatePullReview(ctx *context.TeaContext, idx int64, status gitea.ReviewStateType, ...) error
- func EditIssue(ctx *context.TeaContext, client *gitea.Client, opts EditIssueOption) (*gitea.Issue, error)
- func GenerateLoginName(url, user string) (string, error)
- func GetDefaultPRBase(login *config.Login, owner, repo string) (string, error)
- func GetDefaultPRHead(localRepo *local_git.TeaRepo) (owner, branch string, err error)
- func GetDefaultPRTitle(header string) string
- func GetHeadSpec(owner, branch, baseOwner string) string
- func LabelsExport(labels []*gitea.Label, path string) error
- func ListSSHPubkey() []string
- func OpenFileInEditor(filename string) error
- func ParseDiffComments(diffFile string) ([]gitea.CreatePullReviewComment, error)
- func PullCheckout(login *config.Login, repoOwner, repoName string, forceCreateBranch bool, ...) error
- func PullClean(login *config.Login, repoOwner, repoName string, index int64, ignoreSHA bool, ...) error
- func PullMerge(login *config.Login, repoOwner, repoName string, index int64, ...) error
- func RepoClone(path string, login *config.Login, repoOwner, repoName string, ...) (*local_git.TeaRepo, error)
- func ResolveLabelNames(client *gitea.Client, owner, repo string, labelNames []string) ([]int64, error)
- func SavePullDiff(ctx *context.TeaContext, idx int64) (string, error)
- func SetupHelper(login config.Login) (ok bool, err error)
- type EditIssueOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIssue ¶ added in v0.7.0
func CreateIssue(login *config.Login, repoOwner, repoName string, opts gitea.CreateIssueOption) error
CreateIssue creates an issue in the given repo and prints the result
func CreateLogin ¶
func CreateLogin(name, token, user, passwd, otp, scopes, sshKey, giteaURL, sshCertPrincipal, sshKeyFingerprint string, insecure, sshAgent, versionCheck, addHelper bool) error
CreateLogin create a login to be stored in config
func CreateMilestone ¶ added in v0.7.0
func CreateMilestone(login *config.Login, repoOwner, repoName, title, description string, deadline *time.Time, state gitea.StateType) error
CreateMilestone creates a milestone in the given repo and prints the result
func CreatePull ¶
func CreatePull(ctx *context.TeaContext, base, head string, allowMaintainerEdits bool, opts *gitea.CreateIssueOption) (err error)
CreatePull creates a PR in the given repo and prints the result
func CreatePullReview ¶ added in v0.7.0
func CreatePullReview(ctx *context.TeaContext, idx int64, status gitea.ReviewStateType, comment string, codeComments []gitea.CreatePullReviewComment) error
CreatePullReview submits a review for a PR
func EditIssue ¶ added in v0.10.0
func EditIssue(ctx *context.TeaContext, client *gitea.Client, opts EditIssueOption) (*gitea.Issue, error)
EditIssue edits an issue and returns the updated issue.
func GenerateLoginName ¶
GenerateLoginName generates a name string based on instance URL & adds username if the result is not unique
func GetDefaultPRBase ¶
GetDefaultPRBase retrieves the default base branch for the given repo
func GetDefaultPRHead ¶
GetDefaultPRHead uses the currently checked out branch, tries to find a remote that has a branch with the same name, and extracts the owner from its URL. If no remote matches, owner is empty, meaning same as head repo owner.
func GetDefaultPRTitle ¶
GetDefaultPRTitle transforms a string like a branchname to a readable text
func GetHeadSpec ¶
GetHeadSpec creates a head string as expected by gitea API
func LabelsExport ¶
LabelsExport save list of labels to disc
func ListSSHPubkey ¶ added in v0.10.0
func ListSSHPubkey() []string
ListSSHPubkey lists all the ssh keys in the ssh agent and the ~/.ssh/*.pub files It returns a list of SSH keys in the format of: "fingerprint keytype comment - principals: principals (ssh-agent or path to pubkey file)"
func OpenFileInEditor ¶ added in v0.7.0
OpenFileInEditor opens filename in a text editor, and blocks until the editor terminates.
func ParseDiffComments ¶ added in v0.7.0
func ParseDiffComments(diffFile string) ([]gitea.CreatePullReviewComment, error)
ParseDiffComments reads a diff, extracts comments from it & returns them in a gitea compatible struct
func PullCheckout ¶
func PullCheckout( login *config.Login, repoOwner, repoName string, forceCreateBranch bool, index int64, callback func(string) (string, error), ) error
PullCheckout checkout current workdir to the head branch of specified pull request
func PullClean ¶
func PullClean(login *config.Login, repoOwner, repoName string, index int64, ignoreSHA bool, callback func(string) (string, error)) error
PullClean deletes local & remote feature-branches for a closed pull
func PullMerge ¶ added in v0.10.0
func PullMerge(login *config.Login, repoOwner, repoName string, index int64, opt gitea.MergePullRequestOption) error
PullMerge merges a PR
func RepoClone ¶ added in v0.9.0
func RepoClone( path string, login *config.Login, repoOwner, repoName string, callback func(string) (string, error), depth int, ) (*local_git.TeaRepo, error)
RepoClone creates a local git clone in the given path, and sets up upstream remote for fork repos, for good usability with tea.
func ResolveLabelNames ¶ added in v0.7.0
func ResolveLabelNames(client *gitea.Client, owner, repo string, labelNames []string) ([]int64, error)
ResolveLabelNames returns a list of label IDs for a given list of label names
func SavePullDiff ¶ added in v0.7.0
func SavePullDiff(ctx *context.TeaContext, idx int64) (string, error)
SavePullDiff fetches the diff of a pull request and stores it as a temporary file. The path to the file is returned.
Types ¶
type EditIssueOption ¶ added in v0.10.0
type EditIssueOption struct { Index int64 Title *string Body *string Ref *string Milestone *string Deadline *time.Time AddLabels []string RemoveLabels []string AddAssignees []string }
EditIssueOption wraps around gitea.EditIssueOption which has bad & incosistent semantics.