Documentation ¶
Index ¶
- func Checkout(options ...types.Option) (string, error)
- func Clone(options ...types.Option) (string, error)
- func Cond(apply bool, option types.Option) func(*types.Cmd)
- func Config(options ...types.Option) (string, error)
- func Debug(g *types.Cmd)
- func Debuggger(debug bool) func(*types.Cmd)
- func Fetch(options ...types.Option) (string, error)
- func Init(options ...types.Option) (string, error)
- func NoOp(g *types.Cmd)
- func Push(options ...types.Option) (string, error)
- func Rebase(options ...types.Option) (string, error)
- func Remote(options ...types.Option) (string, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checkout ¶
Checkout https://git-scm.com/docs/git-checkout
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Checkout(checkout.NewBranch, checkout.Branch("myBranchName")) fmt.Println(out)
Output: git checkout -b myBranchName
func Clone ¶
Clone https://git-scm.com/docs/git-clone
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Clone(clone.Repository("git@github.com:ldez/go-git-cmd-wrapper.git")) fmt.Println(out)
Output: git clone git@github.com:ldez/go-git-cmd-wrapper.git
func Cond ¶
Cond apply conditionally an option
Example ¶
cmdExecutor = cmdExecutorMock param := false out, _ := Push(push.All, Cond(param, push.DryRun), push.FollowTags, push.ReceivePack("aaa")) fmt.Print(out) param = true out, _ = Push(push.All, Cond(param, push.DryRun), push.FollowTags, push.ReceivePack("aaa")) fmt.Print(out)
Output: git push --all --follow-tags --receive-pack=aaa git push --all --dry-run --follow-tags --receive-pack=aaa
func Config ¶
Config https://git-scm.com/docs/git-config
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Config(config.Entry("rebase.autoSquash", "true")) fmt.Println(out)
Output: git config rebase.autoSquash true
func Fetch ¶
Fetch https://git-scm.com/docs/git-fetch
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Fetch(fetch.NoTags, fetch.Remote("upstream"), fetch.RefSpec("myBranchName")) fmt.Println(out)
Output: git fetch --no-tags upstream myBranchName
func Init ¶
Init https://git-scm.com/docs/git-init
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Init(ginit.Bare, ginit.Quiet, ginit.Directory("foobar")) fmt.Println(out)
Output: git init --bare --quiet foobar
func Push ¶
Push https://git-scm.com/docs/git-push
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Push(push.All, push.FollowTags, push.ReceivePack("aaa")) fmt.Println(out)
Output: git push --all --follow-tags --receive-pack=aaa
func Rebase ¶
Rebase https://git-scm.com/docs/git-rebase
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Rebase(rebase.PreserveMerges, rebase.Branch(fmt.Sprintf("%s/%s", "upstream", "master"))) fmt.Println(out)
Output: git rebase --preserve-merges upstream/master
func Remote ¶
Remote https://git-scm.com/docs/git-remote
Example ¶
cmdExecutor = cmdExecutorMock out, _ := Remote(remote.Add, remote.Name("upstream"), remote.URL("git@github.com:johndoe/go-git-cmd-wrapper.git")) fmt.Println(out)
Output: git remote add upstream git@github.com:johndoe/go-git-cmd-wrapper.git
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.