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