- .gitignore from sample dirs, create via template
This commit is contained in:
@@ -10,3 +10,19 @@ Usage examples:
|
|||||||
scaffold go NewGoProject
|
scaffold go NewGoProject
|
||||||
scaffold py aPythonProject
|
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
|
||||||
|
`
|
||||||
|
|||||||
8
main.go
8
main.go
@@ -176,6 +176,14 @@ func main() {
|
|||||||
_, err = exec.Command("git", "init").Output()
|
_, err = exec.Command("git", "init").Output()
|
||||||
ifFerr("Unable to initialize git repository", err)
|
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
|
// stage files
|
||||||
_, err = exec.Command("git", "add", ".").Output()
|
_, err = exec.Command("git", "add", ".").Output()
|
||||||
ifFerr("Unable to stage files prior to first commit", err)
|
ifFerr("Unable to stage files prior to first commit", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user