git

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists() bool

Exists checks to make sure it can find the git executable

func GetUser

func GetUser() (user string, email string)

GetUser returns the global git user info

func RemoveGlobalUser

func RemoveGlobalUser()

RemoveGlobalUser removes user from the global git config

func SetGitPath

func SetGitPath(gitPath string)

SetGitPath will set a custom git path if necessary

func SetGlobalUser

func SetGlobalUser(user string, email string)

SetGlobalUser sets the user for the global git config

func Version

func Version() string

Version returns the git version in use

Types

type Profile

type Profile struct {
	Name  string
	User  string
	Email string
}

Profile defines a git profile

func (Profile) IsEmpty

func (p Profile) IsEmpty() bool

IsEmpty returns true if this profile has no info

func (Profile) String

func (p Profile) String() (out string)

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

Repo allows you to exectue actions on a specific git project

func NewGitRepo

func NewGitRepo(path string) *Repo

NewGitRepo constructs a git repo for you

func (Repo) GetUser

func (r Repo) GetUser() (user string, email string)

GetUser returns the repo user

func (Repo) HasUserSet

func (r Repo) HasUserSet() bool

HasUserSet returns if repo has a user set

func (Repo) Name

func (r Repo) Name() string

Name returns the name of the repo, this is just the base folder name

func (Repo) Path

func (r Repo) Path() string

Path returns the repos full path

func (Repo) RemoveUser

func (r Repo) RemoveUser()

RemoveUser removes the set user from the git repo

func (Repo) SetUser

func (r Repo) SetUser(user string, email string)

SetUser sets the user for a git repo

type UserProfileConfig

type UserProfileConfig struct {
	// contains filtered or unexported fields
}

UserProfileConfig is the config file we want to edit

func NewUserProfileConfig

func NewUserProfileConfig(hintPath string) (*UserProfileConfig, error)

NewUserProfileConfig initializes and returns a new UserProfileConfig

func (UserProfileConfig) AddProfile

func (u UserProfileConfig) AddProfile(name string, user string, email string)

AddProfile adds a profile

func (UserProfileConfig) CheckProfile

func (u UserProfileConfig) CheckProfile(name string) bool

CheckProfile checks if name exists as a profile

func (UserProfileConfig) DeleteProfile

func (u UserProfileConfig) DeleteProfile(name string)

DeleteProfile removes a profile from the config

func (UserProfileConfig) EditProfile

func (u UserProfileConfig) EditProfile(name string, user string, email string)

EditProfile edits a profile

func (UserProfileConfig) GetAllProfiles

func (u UserProfileConfig) GetAllProfiles() (profiles []Profile)

GetAllProfiles gets all of the saved profiles

func (UserProfileConfig) GetProfile

func (u UserProfileConfig) GetProfile(name string) (profile Profile)

GetProfile gets the profile info

func (UserProfileConfig) Path

func (u UserProfileConfig) Path() string

Path returns the user profile path

Jump to

Keyboard shortcuts

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