add formatting + check which (controllers, types) to compile
This commit is contained in:
parent
f3b442e810
commit
d9460952ab
|
@ -27,6 +27,8 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var projectPathFlag = flag.Arg(0)
|
var projectPathFlag = flag.Arg(0)
|
||||||
|
compileTypes := true
|
||||||
|
compileControllers := true
|
||||||
|
|
||||||
/* (2) Get absolute paths
|
/* (2) Get absolute paths
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
|
@ -58,28 +60,41 @@ func main() {
|
||||||
|
|
||||||
/* (3) Check path are existing dirs
|
/* (3) Check path are existing dirs
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
|
clifmt.Title("Check files")
|
||||||
|
|
||||||
/* (1) Project path */
|
/* (1) Project path */
|
||||||
|
clifmt.Align(" . project root")
|
||||||
if stat, err := os.Stat(projectPath); err != nil || !stat.IsDir() {
|
if stat, err := os.Stat(projectPath); err != nil || !stat.IsDir() {
|
||||||
|
fmt.Printf("invalid\n\n")
|
||||||
fmt.Printf("%s invalid project folder - %s\n\n", clifmt.Warn(), clifmt.Color(36, projectPath))
|
fmt.Printf("%s invalid project folder - %s\n\n", clifmt.Warn(), clifmt.Color(36, projectPath))
|
||||||
fmt.Printf("You must specify an existing directory path\n")
|
fmt.Printf("You must specify an existing directory path\n")
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
fmt.Printf("ok\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (2) Controllers path */
|
/* (2) Controllers path */
|
||||||
|
clifmt.Align(" . controllers")
|
||||||
if stat, err := os.Stat(cPath); err != nil || !stat.IsDir() {
|
if stat, err := os.Stat(cPath); err != nil || !stat.IsDir() {
|
||||||
fmt.Printf("%s invalid controllers' folder - %s\n\n", clifmt.Warn(), clifmt.Color(36, cPath))
|
compileControllers = false
|
||||||
fmt.Printf("You must specify an existing directory path\n")
|
fmt.Printf("missing\n")
|
||||||
return
|
} else {
|
||||||
|
fmt.Printf("ok\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (3) Types path */
|
/* (3) Types path */
|
||||||
|
clifmt.Align(" . custom types")
|
||||||
if stat, err := os.Stat(tPath); err != nil || !stat.IsDir() {
|
if stat, err := os.Stat(tPath); err != nil || !stat.IsDir() {
|
||||||
fmt.Printf("%s invalid types folder - %s\n\n", clifmt.Warn(), clifmt.Color(36, tPath))
|
fmt.Printf("missing\n")
|
||||||
fmt.Printf("You must specify an existing directory path\n")
|
compileTypes = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fmt.Printf("ok\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !compileControllers && !compileTypes {
|
||||||
|
fmt.Printf("\n%s\n", clifmt.Info("Nothing to compile"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%s\n", projectPath)
|
|
||||||
fmt.Printf("%s\n", cPath)
|
|
||||||
fmt.Printf("%s\n", tPath)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue