update gitfetch to use builtins, add config option for author

This commit is contained in:
2023-02-07 15:16:42 -08:00
parent 9271b27511
commit 7d080ff153
3 changed files with 30 additions and 71 deletions

View File

@@ -5,9 +5,11 @@ import (
"os"
git "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/taigrr/mg/parse"
"github.com/taigrr/gico/types"
"github.com/taigrr/mg/parse"
)
type (
@@ -42,3 +44,19 @@ func GetMRRepos() (RepoSet, error) {
paths := mrconf.GetRepoPaths()
return RepoSet(paths), nil
}
func GetAuthorName() (string, error) {
conf, err := config.LoadConfig(config.GlobalScope)
if err != nil {
return "", err
}
return conf.Author.Name, nil
}
func GetAuthorEmail() (string, error) {
conf, err := config.LoadConfig(config.GlobalScope)
if err != nil {
return "", err
}
return conf.Author.Email, nil
}