task

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

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

func GenerateLoginName(url, user string) (string, error)

GenerateLoginName generates a name string based on instance URL & adds username if the result is not unique

func GetDefaultPRBase

func GetDefaultPRBase(login *config.Login, owner, repo string) (string, error)

GetDefaultPRBase retrieves the default base branch for the given repo

func GetDefaultPRHead

func GetDefaultPRHead(localRepo *local_git.TeaRepo) (owner, branch string, err error)

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

func GetDefaultPRTitle(header string) string

GetDefaultPRTitle transforms a string like a branchname to a readable text

func GetHeadSpec

func GetHeadSpec(owner, branch, baseOwner string) string

GetHeadSpec creates a head string as expected by gitea API

func LabelsExport

func LabelsExport(labels []*gitea.Label, path string) error

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

func OpenFileInEditor(filename string) error

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.

func SetupHelper added in v0.10.0

func SetupHelper(login config.Login) (ok bool, err error)

SetupHelper add tea helper to config global

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL