-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
69 lines (54 loc) · 1.47 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
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/rivo/tview"
_ "riakg/components/buckettree"
"riakg/components/container"
_ "riakg/components/keylist"
_ "riakg/components/valueview"
"riakg/riakapi"
)
var Version string = "0.3.1"
func init() {
getParams()
log.SetOutput(os.Stdout)
}
func main() {
app := tview.NewApplication()
container.App = app
flex := tview.NewFlex()
container.AddComponent("mainLayout", flex)
bucketTreeUntyped, _ := container.GetComponent("bucketTree")
keyListUntyped, _ := container.GetComponent("WrappedkeyList")
valueViewUntyped, _ := container.GetComponent("WrappedvalueView")
container.ExecuteAfterInitialize()
flex.AddItem(bucketTreeUntyped.(*tview.TreeView), 0, 1, true)
flex.AddItem(keyListUntyped.(*tview.Flex), 0, 1, false)
flex.AddItem(valueViewUntyped.(*tview.Flex), 0, 2, false)
if err := app.SetRoot(flex, true).SetFocus(flex).Run(); err != nil {
panic(err)
}
}
func getParams() {
for _, v := range os.Args {
if v == "-v" || v == "-version" || v == "version" {
fmt.Println(Version)
os.Exit(1)
}
}
host := flag.String("host", "localhost", "server ip or domain")
port := flag.String("port", "8098", "server port")
username := flag.String("username", "", "Username")
password := flag.String("password", "", "password")
flag.Parse()
riakapi.Host = *host
riakapi.Port = *port
riakapi.Username = *username
riakapi.Password = *password
}
func otherFunction() {
fmt.Println("this is another function")
}