git 支持配置开发者信息

This commit is contained in:
白茶清欢 2022-06-14 20:44:07 +08:00
parent 08219b7219
commit 53f7f3a859

22
git.go
View File

@ -148,3 +148,25 @@ release
FinishTime: 0, FinishTime: 0,
} }
} }
// ConfigAuthor 配置开发人员信息
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 20:40 2022/6/14
func (g *git) ConfigAuthor(name string, email string) *define.Result {
// git config user.name 白茶清欢
if len(name) > 0 {
param := []string{"config", "user.name", name}
if r := Execute(g.workDir, g.gitCmdPath, param); nil != r.Error {
return r
}
}
if len(email) > 0 {
param := []string{"config", "user.email", email}
if r := Execute(g.workDir, g.gitCmdPath, param); nil != r.Error {
return r
}
}
return nil
}