-
Notifications
You must be signed in to change notification settings - Fork 0
/
parameters.go
38 lines (33 loc) · 995 Bytes
/
parameters.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
package main
import (
"flag"
)
type Parameters struct {
ProjectName string
CreateProject bool
BuildProject bool
CleanBuild bool
Serve bool
Version bool
BuildDir string
}
func readParameters() *Parameters {
// TODO: Change projectName variable name
projectName := flag.String("project", "", "path to the project")
createProject := flag.Bool("create", false, "set to create new project")
buildProject := flag.Bool("build", false, "build project and quit")
cleanBuild := flag.Bool("clean", false, "set to clean built project")
serve := flag.Bool("serve", false, "build and run server")
version := flag.Bool("version", false, "show version info")
buildDir := flag.String("build-dir", "", "build directory")
flag.Parse()
return &Parameters{
ProjectName: *projectName,
CreateProject: *createProject,
BuildProject: *buildProject,
CleanBuild: *cleanBuild,
Serve: *serve,
Version: *version,
BuildDir: *buildDir,
}
}