-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.go
73 lines (63 loc) · 1.63 KB
/
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package main
import (
"fmt"
"github.com/docopt/docopt-go"
"math/rand"
"time"
"github.com/zeusproject/zeus-server/account"
"github.com/zeusproject/zeus-server/char"
"github.com/zeusproject/zeus-server/inter"
"github.com/zeusproject/zeus-server/utils/migrations"
"github.com/zeusproject/zeus-server/zone"
)
func main() {
rand.Seed(time.Now().Unix())
usage := `Zeus Server
Usage:
zeus-server db migrate [up | down]
zeus-server server account [options]
zeus-server server char [options]
zeus-server server inter [options]
zeus-server server zone [options]
zeus-server -h | --help
zeus-server --version
Options:
-h --help Show this screen.
--version Show version.
--nobanner Supress banner.
`
args, err := docopt.Parse(usage, nil, true, "Zeus Server 1.0", false)
if err != nil {
fmt.Printf("%v\n", err)
return
}
if args["server"] == true {
if args["nobanner"] != true {
fmt.Printf("\t \n")
fmt.Printf("\t \n")
fmt.Printf("\t _______ _ _ ___ \n")
fmt.Printf("\t|_ / _ \\ | | / __|\n")
fmt.Printf("\t / / __/ |_| \\__ \\\n")
fmt.Printf("\t/___\\___|\\__,_|___/\n")
fmt.Printf("\t \n")
fmt.Printf("\t \n")
}
if args["account"] == true {
account.Run(args)
} else if args["char"] == true {
char.Run(args)
} else if args["inter"] == true {
inter.Run(args)
} else if args["zone"] == true {
zone.Run(args)
}
} else if args["db"] == true {
if args["migrate"] == true {
if args["up"] == true {
migrations.RunUp(args)
} else if args["down"] == true {
migrations.RunDown(args)
}
}
}
}