-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
84 lines (66 loc) · 1.65 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package main
import (
"log"
ui "github.com/awesome-gocui/gocui"
)
const (
AllViews = ""
ProjectsView = "projects"
StatusesView = "statuses"
IssuesView = "issues"
DetailsView = "details"
PromptView = "prompt"
AlertView = "alert"
)
var (
ProjectsList *List
StatusesList *List
IssuesList *List
Details *ui.View
PromptDialog *Dialog
AlertDialog *Dialog
)
func main() {
initConfigSetup()
// Initialize the gocui library
g, err := ui.NewGui(ui.OutputNormal, true)
if err != nil {
log.Panicln("Failed to initialize GUI", err)
}
defer g.Close()
g.Cursor = false
// Set up the main screen and keybindings
g.SetManagerFunc(layout)
if err := keybindings(g); err != nil {
log.Panicln("Failed to attach keybindings", err)
}
tw, th := g.Size()
rw, rh := relativeSize(g)
v, err := g.SetView(ProjectsView, 0, 0, rw, th-rh, 0)
if err != nil && err != ui.ErrUnknownView {
log.Panicln("Failed to create view", err)
}
ProjectsList = CreateList(v, false)
ProjectsList.Title = makeTabNames(ProjectsView)
ProjectsList.Focus(g)
g.Update(func(g *ui.Gui) error {
loadProjects()
return nil
})
v, err = g.SetView(IssuesView, 0, th-rh+1, rw, th-3, 0)
if err != nil && err != ui.ErrUnknownView {
log.Panicln("Failed to create view", err)
}
IssuesList = CreateList(v, false)
IssuesList.Title = " Issues "
Details, err = g.SetView(DetailsView, rw+1, 0, tw-1, th-3, 0)
if err != nil && err != ui.ErrUnknownView {
log.Panicln("Failed to create Details view", err)
}
Details.Title = " Details "
Details.Wrap = true
// Start the main event loop
if err := g.MainLoop(); err != nil && err != ui.ErrQuit {
log.Panicln(err)
}
}