-
Notifications
You must be signed in to change notification settings - Fork 75
/
main.go
45 lines (34 loc) · 1.08 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
package main
import (
"flag"
"fmt"
"github.com/mylxsw/redis-tui/api"
"github.com/mylxsw/redis-tui/config"
"github.com/mylxsw/redis-tui/core"
"github.com/mylxsw/redis-tui/tui"
)
var conf = config.Config{}
var Version string
var GitCommit string
func main() {
flag.StringVar(&conf.Host, "h", "127.0.0.1", "Server hostname")
flag.IntVar(&conf.Port, "p", 6379, "Server port")
flag.StringVar(&conf.Password, "a", "", "Password to use when connecting to the server")
flag.IntVar(&conf.DB, "n", 0, "Database number")
flag.BoolVar(&conf.Cluster, "c", false, "Enable cluster mode")
flag.BoolVar(&conf.Debug, "vvv", false, "Enable debug mode")
var showVersion bool
flag.BoolVar(&showVersion, "v", false, "Show version and exit")
flag.Parse()
if len(GitCommit) > 8 {
GitCommit = GitCommit[:8]
}
if showVersion {
fmt.Printf("Version: %s\nGitCommit: %s\n", Version, GitCommit)
return
}
outputChan := make(chan core.OutputMessage, 100)
if err := tui.NewRedisTUI(api.NewRedisClient(conf, outputChan), 100, Version, GitCommit, outputChan, conf).Start(); err != nil {
panic(err)
}
}