-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (38 loc) · 922 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
package main
import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var version string = "master" // Replaced by linker, see Makefile
var log = logrus.New()
func main() {
log.SetLevel(logrus.DebugLevel)
var cmdVersion = &cobra.Command{
Use: "version",
Short: "Print version of eimaster",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
println(version)
},
}
var cmdClient = &cobra.Command{
Use: "client",
Short: "Client commands",
}
for _, cmd := range clientCmds {
cmdClient.AddCommand(cmd)
}
var cmdServer = &cobra.Command{
Use: "server",
Short: "Server commands",
}
for _, cmd := range serverCmds {
cmdServer.AddCommand(cmd)
}
var rootCmd = &cobra.Command{
Use: "eimaster",
Short: "EI master is a server which hosts list of running game servers",
}
rootCmd.AddCommand(cmdClient, cmdServer, cmdVersion)
rootCmd.Execute()
}