1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-12-07 08:58:07 +00:00

Add -print-example-config

This commit is contained in:
bouncepaw
2021-03-09 19:27:14 +05:00
parent d2792ff83d
commit e35643bb9d
7 changed files with 262 additions and 156 deletions

View File

@@ -13,11 +13,22 @@ import (
"github.com/bouncepaw/mycorrhiza/util"
)
// Path to git executable. Set at init()
var gitpath string
var renameMsgPattern = regexp.MustCompile(`^Rename (.*) to .*`)
// Start initializes git credentials.
// Start finds git and initializes git credentials.
func Start(wikiDir string) {
_, err := gitsh("config", "user.name", "wikimind")
path, err := exec.LookPath("git")
if err != nil {
log.Fatal("Cound not find the git executable. Check your $PATH.")
} else {
log.Println("Git path is", path)
}
gitpath = path
_, err = gitsh("config", "user.name", "wikimind")
if err != nil {
log.Fatal(err)
}
@@ -110,20 +121,6 @@ func (rev *Revision) bestLink() string {
}
}
// Path to git executable. Set at init()
var gitpath string
func init() {
path, err := exec.LookPath("git")
if err != nil {
log.Fatal("Cound not find the git executable. Check your $PATH.")
} else {
log.Println("Git path is", path)
}
gitpath = path
}
// I pronounce it as [gɪt͡ʃ].
// gitsh is async-safe, therefore all other git-related functions in this module are too.
func gitsh(args ...string) (out bytes.Buffer, err error) {