git

package
v0.0.0-...-36e834a Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SCMDCheckout is the git sub command for checkout.
	SCMDCheckout string = "checkout"
	// SCMDBranch is the git sub command for branch.
	SCMDBranch string = "branch"
)
View Source
const (
	// CMDGit is the git shell command.
	CMDGit = "git"
)

Variables

View Source
var ErrSubCommandEmpty = errors.New("Git sub-command is empty")

ErrSubCommandEmpty indicates that Config did not validate because of zero valued SubCommand.

Functions

This section is empty.

Types

type Call

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

Call holds the attributes required to invoke git.

func (*Call) Args

func (c *Call) Args() []string

Args return the call args.

func (*Call) Checkout

func (c *Call) Checkout(branch string) error

Checkout runs git checkout on the current git repo.

func (*Call) Git

func (c *Call) Git() (ExecCmd, error)

Git returns a exec.Cmd for git ready with the passed configuration.

func (*Call) Run

func (c *Call) Run() error

Run runs git according to the passed config and returns err if it fails.

func (*Call) SetArgs

func (c *Call) SetArgs(a []string)

SetArgs sets the call args.

func (*Call) SetSubCommand

func (c *Call) SetSubCommand(s string)

SetSubCommand sets the call sub command.

func (*Call) SubCommand

func (c *Call) SubCommand() string

SubCommand returns subcommands

func (*Call) Validate

func (c *Call) Validate() error

Validate checks that Call has all the required attributes.

type CommandCraftFunc

type CommandCraftFunc func([]string) ExecCmd

CommandCraftFunc represents a function that creates an ExecCmd from a command/args string slice.

type Compatible

type Compatible interface {
	Git() (ExecCmd, error)
	Run() error
	Checkout(string) error

	SubCommand() string
	SetSubCommand(string)

	Args() []string
	SetArgs([]string)
}

Compatible represents a struct that can perform all the tasks that git should.

func New

func New(s string, a []string) Compatible

New returns a new git Call

type CompatibleConstructor

type CompatibleConstructor func(string, []string) Compatible

CompatibleConstructor returns a new Git Compatible struct.

type ExecCmd

type ExecCmd interface {
	Run() error
	Output() ([]byte, error)
}

ExecCmd represents exec.Cmd

Jump to

Keyboard shortcuts

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