- .gitignore from sample dirs, create via template

This commit is contained in:
2023-04-09 16:51:19 -04:00
parent 1c86111737
commit 38c3a87dd2
2 changed files with 24 additions and 0 deletions

View File

@@ -10,3 +10,19 @@ Usage examples:
scaffold go NewGoProject
scaffold py aPythonProject
`
var gi_template = `%s
.env
*.env
.env.toml
cfg/*.toml
cfg/.env
cfg/*.env
cfg/.env*
*.toml
build/
buildTime.txt
buildVersion.txt
`

View File

@@ -176,6 +176,14 @@ func main() {
_, err = exec.Command("git", "init").Output()
ifFerr("Unable to initialize git repository", err)
nifd, err := os.Create(".gitignore")
ifFerr("Unable to create .gitignore file", err)
defer nifd.Close()
gi_content := fmt.Sprintf(gi_template, newProjectName)
_, err = nifd.WriteString(gi_content)
ifFerr("Unable to write .gitignore content", err)
fmt.Println("Wrote .gitignore content")
// stage files
_, err = exec.Command("git", "add", ".").Output()
ifFerr("Unable to stage files prior to first commit", err)