-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
54 lines (47 loc) · 897 Bytes
/
main.go
File metadata and controls
54 lines (47 loc) · 897 Bytes
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
package main
import (
"io/ioutil"
"os"
"github.com/g-dx/rosslyn/slack"
"log"
"github.com/g-dx/rosslyn/ui"
"github.com/nsf/termbox-go"
"runtime/debug"
)
func main() {
// Setup logging
f, err := os.Create(os.ExpandEnv("${HOME}/.rosslyn/app.log"))
if err != nil {
panic(err)
}
logger := log.New(f, "", log.Ldate | log.Ltime)
token, err := ioutil.ReadFile(os.ExpandEnv("${HOME}/.rosslyn/api-token"))
if err != nil {
panic(err)
}
//
//
// Configure the UI
//
//
err = termbox.Init()
if err != nil {
panic(err)
}
defer termbox.Close()
termbox.SetInputMode(termbox.InputEsc)
termbox.SetOutputMode(termbox.Output256)
//
//
// Connect to Slack
//
//
defer func() {
if err := recover(); err != nil {
logger.Printf("Panic: %v\nStacktrace: %s\n", err, debug.Stack())
panic(err)
}
}()
ctrl := ui.NewController(logger, slack.NewApis(token))
ctrl.Run()
}