model

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package model provides the model of repository and commit. As long as another model that will be use in gitgo command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

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

Commit is Commit object of deal with commit things.

func (*Commit) CanCommit

func (c *Commit) CanCommit() bool

CanCommit mean this commit contain no errors

func (*Commit) Commit

func (c *Commit) Commit(hasMessage bool)

Commit is action for ask the message from user and call CustomCommit.

func (*Commit) CustomCommit

func (c *Commit) CustomCommit(answers CommitMessage)

CustomCommit will run git commit -m "<message>" with the default format.

func (*Commit) ListHeaderOptions

func (c *Commit) ListHeaderOptions() *manager.ResultWrapper

ListHeaderOptions return the list of string of commit that create by Format() method in CommitHeader.

func (*Commit) LoadList

func (c *Commit) LoadList(vp *viper.Viper) *Commit

LoadList will initial new list of Header.

func (*Commit) MergeList

func (c *Commit) MergeList(vp *viper.Viper) *Commit

MergeList will merge current list to the new ones.

type CommitHeader

type CommitHeader struct {
	Key   string
	Value string
}

CommitHeader is struct of Key and Value, using in list.yaml.

func (*CommitHeader) Format

func (c *CommitHeader) Format() string

Format will return format of string.

func (*CommitHeader) String

func (c *CommitHeader) String() string

String will return string that show what is it.

type CommitMessage

type CommitMessage struct {
	Key     string
	Title   string
	Message string
}

CommitMessage is the commit message for save in commit.

func (*CommitMessage) GetKey

func (c *CommitMessage) GetKey() string

GetKey will try to format the key to right way. Otherwise, return normal Key

type GitCommand

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

GitCommand is git-cli command with custom stdout and custom stderr

func Git

func Git() *GitCommand

Git will return singleton GitCommand

func (*GitCommand) Exec

func (g *GitCommand) Exec(args ...string) *manager.ErrManager

Exec will run git cli in command line

func (*GitCommand) SetErrWriter

func (g *GitCommand) SetErrWriter(err io.Writer) *GitCommand

SetErrWriter will set err writer

func (*GitCommand) SetOutWriter

func (g *GitCommand) SetOutWriter(out io.Writer) *GitCommand

SetOutWriter will set out writer

func (*GitCommand) SetReader

func (g *GitCommand) SetReader(in io.Reader) *GitCommand

SetReader will set reader

type Repo

type Repo struct {
	Manager *manager.ResultManager
	// contains filtered or unexported fields
}

Repo is git repository object for gitgo.

func CustomRepo

func CustomRepo(path string) *Repo

CustomRepo will return repo of custom path

func NewRepo

func NewRepo() *Repo

NewRepo will return new repository with current path. you must call setup for load git repository to memory.

func (*Repo) Add

func (r *Repo) Add(filepath []string) *manager.Throwable

Add get array of filepath, and return ErrManager. anyway, It's will run os.Exit with code 10 if any error occurred.

func (*Repo) AddAll

func (r *Repo) AddAll() *manager.Throwable

AddAll will run git add -A command in cli.

func (*Repo) GetCommit

func (r *Repo) GetCommit() *Commit

GetCommit will return Commit object.

func (*Repo) GetGitRepository

func (r *Repo) GetGitRepository() *manager.ResultWrapper

GetGitRepository will return git.Repository of this Repo

func (*Repo) GetWorktree

func (r *Repo) GetWorktree() *manager.ResultWrapper

GetWorktree is getter method, which get git.Worktree from git.Repository. It's will Exit with code 5 if any error occurred.

func (*Repo) Setup

func (r *Repo) Setup()

Setup will load git repository to memory. If any error occurred, exit with code 5.

func (*Repo) Status

func (r *Repo) Status() *manager.ResultWrapper

Status will return *git.Status.

type YAML

type YAML struct{}

YAML is object of config yaml

func GeneratorYAML

func GeneratorYAML() *YAML

GeneratorYAML will return YAML Object

func (*YAML) GDefaultConfig

func (y *YAML) GDefaultConfig() string

GDefaultConfig is global default config.yaml

func (*YAML) GDefaultList

func (y *YAML) GDefaultList() string

GDefaultList is global default list.yaml

func (*YAML) LEmptyList

func (y *YAML) LEmptyList() string

LEmptyList is empty list.yaml

Jump to

Keyboard shortcuts

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