Skip to content

Commit

Permalink
Merge pull request #12 from danielmichaels/iss#10-git-pull
Browse files Browse the repository at this point in the history
Git Pull
  • Loading branch information
danielmichaels authored Apr 29, 2022
2 parents 065cf61 + 3dfa260 commit 0c98948
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var Cmd = &Z.Cmd{

Name: `zet`,
Summary: `zettelkasten commander`,
Version: `v0.0.6`,
Version: `v0.0.7`,
Copyright: `Copyright 2022 Daniel Michaels`,
License: `Apache-2.0`,
Site: `danielms.site`,
Expand All @@ -26,7 +26,7 @@ var Cmd = &Z.Cmd{
help.Cmd, conf.Cmd, vars.Cmd,

// local commands (in this module)
CreateCmd, LastCmd, EditCmd, GetCmd, QueryCmd, FindCmd, CheckCmd, TagsCmd,
CreateCmd, LastCmd, EditCmd, GetCmd, QueryCmd, FindCmd, CheckCmd, TagsCmd, GitCmd,
},
Description: `
The **{{.Name}}** command is Zettelkasten Bonzai branch used to create
Expand Down
27 changes: 27 additions & 0 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,38 @@ import (
"errors"
"fmt"
Z "github.com/rwxrob/bonzai/z"
"github.com/rwxrob/help"
"os"
"path/filepath"
"strings"
)

var GitCmd = &Z.Cmd{
Name: `git`,
Summary: `run git commands over the zet repo`,
MinArgs: 1,
Usage: `must provide a git command`,
Commands: []*Z.Cmd{help.Cmd, gitPull},
}

var gitPull = &Z.Cmd{
Name: `pull`,
Summary: `retrieve upstream latest commits`,
Commands: []*Z.Cmd{help.Cmd},
Call: func(caller *Z.Cmd, args ...string) error {
z := new(Zet)
err := z.ChangeDir(z.GetRepo())
if err != nil {
return err
}
err = Z.Exec("git", "pull")
if err != nil {
return err
}
return nil
},
}

// scanAndCommit checks that the user wants to commit their work to the VCS
// and pushes the commit if they accept.
func (z *Zet) scanAndCommit(zet string) error {
Expand Down

0 comments on commit 0c98948

Please sign in to comment.