-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.go
39 lines (34 loc) · 864 Bytes
/
generator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"github.com/art-injener/QtProjectGenerator/template"
"github.com/art-injener/QtProjectGenerator/tree"
"os"
)
func main() {
fmt.Println("PROJECT GENERATION START")
if !(len(os.Args) == 2) {
fmt.Println("usage : ./generator project_name. \nPROJECT GENERATION ABORT")
os.Exit(0)
}
projectName := os.Args[1]
var path string
if currentDir, errDir := os.Getwd(); errDir == nil {
path = currentDir + "/" + projectName
if _, err := os.Stat(path); !os.IsNotExist(err) {
fmt.Println("This project already exist")
os.Exit(0)
}
}
if e := template.CreateQtProjectTemplate(projectName); e != nil {
fmt.Errorf("Operation is failed : %v", e)
}
out := os.Stdout
if len(path) != 0 {
err := tree.DirTree(out, path, true)
if err != nil {
panic(err.Error())
}
}
fmt.Println("PROJECT GENERATION COMPLETED")
}