git支持生成.gitignore文件
This commit is contained in:
parent
b237251b38
commit
08219b7219
4
.gitignore
vendored
4
.gitignore
vendored
@ -16,8 +16,12 @@
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
# goland的相关配置
|
||||
.idea
|
||||
# vscode 的相关配置
|
||||
.vscode
|
||||
# 构建后的产物目录
|
||||
release
|
||||
*_test.go
|
||||
*.txt
|
||||
|
||||
|
48
git.go
48
git.go
@ -100,3 +100,51 @@ func (g *git) Push(force bool) *define.Result {
|
||||
}
|
||||
return Execute(g.workDir, g.gitCmdPath, param)
|
||||
}
|
||||
|
||||
// AddGitignore 添加 .gitignore 文件
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 20:31 2022/6/14
|
||||
func (g *git) AddGitignore(fileList ...string) *define.Result {
|
||||
baseFileContent := `# Created by .ignore support plugin (hsz.mobi)
|
||||
### Go template
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
*.xlsx
|
||||
|
||||
# Test binary, built with "go test -c"
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
# goland的相关配置
|
||||
.idea
|
||||
# vscode 的相关配置
|
||||
.vscode
|
||||
# 构建后的产物目录
|
||||
release
|
||||
*_test.go
|
||||
*.txt
|
||||
`
|
||||
for _, item := range fileList {
|
||||
baseFileContent = baseFileContent + "\n" + item
|
||||
}
|
||||
// 将信息写入文件
|
||||
return &define.Result{
|
||||
WorkDir: g.workDir,
|
||||
CmdPath: "",
|
||||
Param: nil,
|
||||
Error: File(g.workDir, ".gitignore").Write([]byte(baseFileContent)),
|
||||
Output: nil,
|
||||
StartTime: 0,
|
||||
FinishTime: 0,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user