git

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BranchSync     = "[sync]"
	BranchGone     = "[deleted]"
	BranchAhead    = "[ahead]"
	BranchBehind   = "[behind]"
	BranchConflict = "[conflict]"
	BranchDetached = "[detached]"
	BranchLocal    = "none"
)

Variables

View Source
var Default = New("")

Functions

func ColorBranchState

func ColorBranchState(state string) string

Types

type BranchDetail

type BranchDetail struct {
	Name string

	State string

	Current bool

	IsRemote bool
	Remote   string

	Commit    string
	CommitMsg string
}

func ParseBranchDetail

func ParseBranchDetail(line string) (*BranchDetail, error)

func (*BranchDetail) ColorName

func (b *BranchDetail) ColorName() string

func (*BranchDetail) ColorRemote

func (b *BranchDetail) ColorRemote() string

type Repository

type Repository struct {
	Path string
}

func New

func New(path string) *Repository

func (*Repository) AddRemote

func (repo *Repository) AddRemote(remote, url string) error

func (*Repository) Checkout

func (repo *Repository) Checkout(name string, create bool) error

func (*Repository) ConfigRemote

func (repo *Repository) ConfigRemote(branch, remote string) error

func (*Repository) ConfigUserEmail

func (repo *Repository) ConfigUserEmail(user, email string) error

func (*Repository) Exec

func (repo *Repository) Exec(args ...string) error

func (*Repository) ExecColor added in v0.0.2

func (repo *Repository) ExecColor(args ...string) error

func (*Repository) Fetch

func (repo *Repository) Fetch(prune, pruneTag bool) error

func (*Repository) GetRemoteURL added in v0.0.2

func (repo *Repository) GetRemoteURL(remote string) (string, error)

func (*Repository) LatestTag

func (repo *Repository) LatestTag() (string, error)

func (*Repository) ListLocalBranches

func (repo *Repository) ListLocalBranches() ([]*BranchDetail, error)

func (*Repository) ListRemoteBranches

func (repo *Repository) ListRemoteBranches(remote string, locals []*BranchDetail) ([]string, error)

func (*Repository) ListRemotes

func (repo *Repository) ListRemotes() ([]string, error)

func (*Repository) ListTags

func (repo *Repository) ListTags() ([]string, error)

func (*Repository) Output

func (repo *Repository) Output(args ...string) (string, error)

func (*Repository) RemoveBranch

func (repo *Repository) RemoveBranch(branch string) error

func (*Repository) SetRemoteURL added in v0.0.2

func (repo *Repository) SetRemoteURL(remote, url string) error

func (*Repository) UncommittedChanges

func (repo *Repository) UncommittedChanges() ([]string, error)

Jump to

Keyboard shortcuts

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