-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (38 loc) · 886 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
package main
import (
"flag"
"log"
"os/user"
"path"
"github.com/nsf/termbox-go"
)
var (
Server string
SSL bool
Email, Token string
ConfigDir string
)
func main() {
flag.StringVar(&Server, "server", "api.brdg.me",
"Server to connect to")
flag.BoolVar(&SSL, "ssl", true, "Whether to use SSL")
defaultConfigDir := ""
if usr, err := user.Current(); err == nil {
defaultConfigDir = path.Join(usr.HomeDir, ".brdg.me")
}
flag.StringVar(&ConfigDir, "config-dir", defaultConfigDir,
"Directory to save config")
flag.Parse()
if ConfigDir != "" {
if err := CreateConfigDirIfNotExists(); err != nil {
log.Printf("Could not make config dir, %v", err)
} else if err := LoadConfig(); err != nil {
log.Printf("Could not load config, %v", err)
}
}
if err := termbox.Init(); err != nil {
log.Panic(err)
}
defer termbox.Close()
NewWindowManager().Run()
}