-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (42 loc) · 871 Bytes
/
main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"fmt"
"log"
"net/http"
"os"
)
const ScipioVersion = "0.1"
func main() {
params := readParameters()
if params.Version {
fmt.Printf("Scipio v%s\n", ScipioVersion)
os.Exit(0)
}
if params.ProjectName == "" {
fmt.Println("--project must not be empty")
os.Exit(1)
}
if params.CreateProject {
createProject(params)
os.Exit(0)
}
if params.CleanBuild {
cleanBuild(params)
os.Exit(0)
}
conf := readConfig(params.ProjectName)
if params.BuildProject {
buildProject(conf, params)
os.Exit(0)
}
if params.Serve {
buildProject(conf, params)
http.Handle("/", http.FileServer(http.Dir(getBuildDir(params))))
log.Println("Serving content on http://localhost:4000")
setupReloading(conf, params)
if err := http.ListenAndServe(":4000", nil); err != nil {
log.Printf("Error: %s\n", err)
os.Exit(1)
}
}
}